How do I force-delete a file on my computer? - macos

I am using Mac OS X El Capitan Public Beta 2.
There is somehow a permission problem with my Desktop (and only this directory) because I can not delete any file.
The classic delete to bin does not work, even though I am prompted a window asking for my password and permission. (I am the administrator).
I also tried a few command lines like sudo rm - R *file* and it tells me that the operation is not permitted even after I enter my password.
Going without the rootless feature of El Capitan did not help either :
sudo nvram boot-args="rootless=0"
sudo reboot
Should I change the permissions of the Desktop directory? If so what are the original ones?
Thank you!

This could be caused by the "rootless" feature introduced in El Capitan... You can find more information about it here .
To disable "rootless", type this in the terminal (you'll have to reboot for the change to apply):
sudo nvram boot-args="rootless=0"
sudo reboot

After numerous try the answer was dead-easy : there is a "lock" option on files and directories in OS X and it was active for my desktop (right click -> information). Interesting is the fact that no command line could break it.

Related

Read-only file system" with SIP disabled in macOS Catalina

I am trying to copy some files from a path to my libs path (/usr/lib), I am trying with sudo cp {my file}/usr/lib/
bit I got this error.
/usr/lib/{my_file} Read-only file system
I have validated and indeed System Integrity Protection is disabled (SIP) I am using macOs Catalina 10.15.4
I Hope you can help me thanks.
You just should try with
sudo mount -uw /
it should work
I just recently joined stack overflow so I am not able to up-vote the above answer. Using sudo mount -uw / definitely works. In my case I needed to add a small script to /sbin to overcome an issue with VMware Tools. Starting with macOS Catalina, disabling SIP and then executing this command as root was the answer.
I'm also new to stack exchange, but want to add that
"sudo mount -uw /" worked. Thank you #Juanse
In my case, was suffering from the problem of Kernel_Task using more than 500% of CPU on my Mid-2012 15 MacBookPro aka (MacBookPro9,1 ) with quad-code Intel Core i7.
After multiple solutions did not work, I went on to try a solution posted at: https://discussions.apple.com/thread/8461404?answerId=33657338022#33657338022
Which instructed me to:
Reboot into recovery mode.
Select Utilities/Terminal, csrutil disable , reboot.
cd:
/System/Library/Extensions/IOPlatformPluginFamily.kext/Contents/PlugIns/X86PlatformPlugin.kext/Contents/Resources
move or delete a file based on my version of Mac as listed in the thread. For my MacBookPro9,1 the file 4B7AC7E43945597E.plist
Reboot into recovery mode
Select Utilities/Terminal, csrutil enable , reboot.
The problem with the solution, is that when I tried to "mv 4B7AC7E43945597E.plist ~", or even "sudo mv 4B7AC7E43945597E.plist ~", I got a read-only file system message. Running "sudo mount -uw /" made the file system writeable. Note that the steps of booting into recovery mode and disabling / enabling csrutil turned off, and then back on the apple System Integrity Protection (SIP), which is necessary if you wish to change certain key system or configuration files.

Reset custom macOS icon in rEFInd

I installed rEFInd the other day to test out some Linux distros.
But what really bugs me is that I have set an icon for my hard drive which is used by rEFInd.
What I tried to reset it:
Removing the icon from the hard drive
Adding another icon to / and named it .VolumeIcon.png
Reinstalling rEFInd
Added another os icons named boot.png and loader.png to EFI/refind/icons on the EFI volume
The only thing that did work was to set another hard drive icon. But I don't want to have an icon at all.
Does anyone know how I could reset rEFInd's cache?
Okay, it seems to be a caching bug. I finally found a workaround.
To fix it I created an invalid .VolumeIcon.icns on my hard drive, rebooted and removed the icon. Now it works like a charm.
Here are the steps and terminal commands:
Become Root with sudo su
sudo su
Create invalid .VolumeIcon.icns in root directory of internal hard drive
echo "" > .VolumeIcon.icns
Exit from root user
exit
Reboot your system
Remove /.VolumeIcon.icns from root directory of internal hard drive
sudo rm /.VolumeIcon.icns

dscl create user doesn't work on el capitan

I am trying to create user on OS X El Capitan with admin priviliges from super-user mode.
After running /sbin/fsck -fy and /sbin/mount -uw / and launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist everything works. But after dscl . -create/Users/USERNAME i got error no such file or directory. I tried it even with SIP disabled but it doesn't work too. Thanks for the help.
In El Capitan, the mounts have been changed so that
not even root can edit files in some mounts...ACL changes.
The feature is called SIP and is explained in other
stack exchange posts:
https://apple.stackexchange.com/questions/208478/how-do-i-disable-system-integrity-protection-sip-aka-rootless-on-os-x-10-11
essentially, can boot into recovery mode, type csrutil disable,
boot back into default user mode, make changes,
then presumably, you might want to re-enable csrutil similarly.
Thanks for the reply, but SIP had no effect.
I finally solved it. The problem was /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist that was used in 10.6 and earlier, I was using /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist
The dscl commands were executed despite the error with plist and user got created.

Lost permission for sudo in OSX El Capitan

I'm new to using OSX (using El Capitan 10.11.3) and while trying to change permissions on a file using sudo, I accidentally corrupted it. Now whenever, I try to use sudo to install anything globally, I'm getting the following error message.
sudo: unable to stat /etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
Is there any way to solve it?
I'm also unable to even view the /etc folder
bash: cd: /etc: Permission denied
When I checked permissions on /etc folder, they are as follows
lrwxr-xr-x# 1 root wheel etc -> private/etc
I had the same issue and in my case the permissions of the root folder got corrupted. What people overlook is that / is in fact also a real, normal directory and just like every directory it has ownership and permissions. Ownership should be root:wheel and permission should be 755 (that's rwxr-xr-x).
The easiest way to restore both was starting Script Editor and then typing and running that script:
do shell script "/usr/sbin/chown root:wheel /" with administrator privileges
do shell script "/bin/chmod 755 /" with administrator privileges
You are prompted for amdin password and then chown and chmod come to the rescue. After that sudo was working again.
Disable System Integrity Protection (rootless)
Reboot the Mac and hold down Command + R keys simultaneously after you hear the startup chime, this will boot OS X into Recovery Mode
When the “OS X Utilities” screen appears, pull down the ‘Utilities’ menu at the top of the screen instead, and choose “Terminal”
Type the following command into the terminal then hit return:
csrutil disable; reboot
You’ll see a message saying that System Integrity Protection has been disabled and the Mac needs to restart for changes to take effect, and the Mac will then reboot itself automatically, just let it boot up as normal

Enthought canopy won't install

I'm having some trouble installing Canopy on my Mac OS X (running 10.9.5) under my primary username. I get to the point where it asks for the location for the Canopy Environment Directory, but when I hit Continue, it crashes. I have been able to install it on the same computer, using my secondary username, but switching between the two usernames is less than ideal. Would love any suggestions. I already tried removing admin status from the secondary username to see if that changed anything, but it did not.
Thanks to anyone who has suggestions!
Any chance that this is relevant? https://support.enthought.com/entries/23707691-Canopy-GUI-requires-extra-setup-steps-when-user-s-home-path-contains-non-ASCII-characters
I actually had the same problem on my Mac. For me, I resolved it by changing the ownership of my home directory:
Open Terminal
Type in the following commands (hit enter after every line):
cd ~
cd ..
sudo chown <your_username> <your_directory>
replace <your_username> with your username, and <your_directory> with the directory in which all your personal files are stored
The last command may ask for a password. If it does, enter your password and hit Enter.

Resources