无法在Mac OsX上编辑bash_profile [英] Cannot edit bash_profile on Mac OsX
问题描述
我正在使用MacOSX Snow Leopard 10.6.8....我是这台计算机上的唯一用户,我应该是管理员.
I am using MacOSX Snow Leopard 10.6.8.... I am the only user on this machine and I should be admin.
我试图编辑我的bash_profile以为其提供简单的别名:
I trying to edit my bash_profile to give it this simple alias:
alias server=' open http://localhost:8000 && python -m SimpleHTTPServer'
但是,当我使用终端并键入:vim ~/. bash_profile
并粘贴此别名时,我收到一条消息,提示由于权限原因我无法保存.
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??
推荐答案
您需要使用sudo打开它.
You need to open it with sudo.
sudo vim ~/.bash_profile
当您显示隐藏文件时,文件显示为灰色,因为Mac OS X将隐藏文件显示为灰色,因此您可以将它们与非隐藏文件区分开.您仍然应该能够编辑文件的权限(不过您不必这样做).
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).
如果您希望能够在没有root用户的情况下进行编辑,则可以更改文件的所有者.
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
这篇关于无法在Mac OsX上编辑bash_profile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!