-5

I'm trying to delete "Install macOS Mojave.app" from my Mac using the terminal command sudo rm -r or rm -rf, but it reports root error/illegal option/directory permission restricted, etc.

What can I do? I paste here some process:

albertop@192 ~ % sudo rm -rf /Users/albertop/Desktop/Install\ macOS\ Mojave.app 
rm: /Users/albertop/Desktop/Install macOS Mojave.app/Contents/SharedSupport/InstallESD.dmg: Operation not permitted
rm: /Users/albertop/Desktop/Install macOS Mojave.app/Contents/SharedSupport: Directory not empty
rm: /Users/albertop/Desktop/Install macOS Mojave.app/Contents: Directory not empty
rm: /Users/albertop/Desktop/Install macOS Mojave.app: Directory not empty
albertop@192 ~ % ls -l/Users/albertop/Desktop/Install\ macOS\ Mojave.app 
ls: illegal option -- /
usage: ls [-@ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1%] [file ...]
albertop@192 ~ % sudo rm /Users/albertop/Desktop/Install\ macOS\ Mojave.app 
Password:
rm: /Users/albertop/Desktop/Install macOS Mojave.app: is a directory
albertop@192 ~ % sudo rm -R /Users/albertop/Desktop/Install\ macOS\ Mojave.app 
override rw-r--r--  root/wheel restricted for /Users/albertop/Desktop/Install macOS Mojave.app/Contents/SharedSupport/InstallESD.dmg? 
rm: /Users/albertop/Desktop/Install macOS Mojave.app/Contents/SharedSupport: Directory not empty
rm: /Users/albertop/Desktop/Install macOS Mojave.app/Contents: Directory not empty
rm: /Users/albertop/Desktop/Install macOS Mojave.app: Directory not empty
2
  • 6
    The "illegal option" is just because you forgot to put a space after ls -l, before the pathname. Commented Oct 5 at 17:36
  • 4
    I’m voting to close this question because it belongs on Ask Different. Commented Oct 6 at 9:32

1 Answer 1

1

You are running into System Integrity Protection I believe. The installer is likely required for system recovery.

The people here answered your question by disabling System Integrity Protection, which I do not recommend.

Note for your future posts: macOS is a weird unix, hence the comment about closing your question for relevance. You may want to ask here next time. Be safe!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.