Can't cd to Desktop folder Mac commandline
By Sarah Scott •
I am using OSX Lion and every time I tried to cd to my Desktop folder using "cd ~" and cd "Desktop" it stays in my home directory instead of going to Desktop. I've tried to perform the commands using sudo but it makes no difference.
Thanks.
71 Answer
Using the sudo command will grant access to any folder or file on the Mac.
The commands sudo cd ~ return and sudo cd Desktop return only appeared to fail. In fact, both commands succeeded but exited without any output.
To demonstrate this try the command sudo -i "cd ~;pwd"return which should print /var/root in the terminal window.
In order to use the same commands interactively, do following:
sudo -ireturncd ~returnpwdreturn
Output
/var/root