Cannot edit bash_profile on Mac OsX [closed]

大兔子大兔子 提交于 2019-12-04 10:08:59

问题


I am using MacOSX Snow Leopard 10.6.8.... I am the only user on this machine and I should be admin.

I trying to edit my bash_profile to give it this simple alias:

alias server=' open http://localhost:8000 && python -m SimpleHTTPServer'

however when I use the terminal and type: vim ~/. bash_profile and paste in this alias I get message saying I cant save due to permissions.

So then I show all hidden files and go to fix the permissions on this file but the file is all grayed out.... I cant change anything. What can I do??


回答1:


You need to open it with sudo.

sudo vim ~/.bash_profile

The file appears greyed-out when you show hidden files because Mac OS X displays hidden files as greyed out so you can differentiate them from non-hidden files. You should still be able to edit the permissions on the file (you don't need to, though).

If you want to be able to edit without being root, you can change the owner of the file.

sudo chown your_user_name ~/.bash_profile


来源:https://stackoverflow.com/questions/11692100/cannot-edit-bash-profile-on-mac-osx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!