【问题标题】:Cannot edit bash_profile on Mac OsX [closed]无法在 Mac OsX 上编辑 bash_profile [关闭]
【发布时间】:2012-07-26 09:15:18
【问题描述】:

我正在使用 MacOSX Snow Leopard 10.6.8....我是这台机器上唯一的用户,我应该是管理员。

我试图编辑我的 bash_profile 给它一个简单的别名:

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

但是,当我使用终端并输入:vim ~/. bash_profile 并粘贴此别名时,我收到消息说由于权限而无法保存。

然后我显示所有隐藏文件并修复此文件的权限,但该文件全部变灰......我无法更改任何内容。我能做什么??

【问题讨论】:

    标签: macos permissions osx-snow-leopard alias .bash-profile


    【解决方案1】:

    你需要用 sudo 打开它。

    sudo vim ~/.bash_profile
    

    当您显示隐藏文件时,该文件显示为灰色,因为 Mac OS X 将隐藏文件显示为灰色,以便您可以将它们与非隐藏文件区分开来。您应该仍然可以编辑文件的权限(但您不需要)。

    如果您希望能够在没有 root 用户的情况下进行编辑,您可以更改文件的所有者。

    sudo chown your_user_name ~/.bash_profile
    

    【讨论】:

      猜你喜欢
      • 2014-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-18
      相关资源
      最近更新 更多