Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot edit bash_profile on Mac OsX [closed]

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??

like image 302
accraze Avatar asked Jul 27 '12 16:07

accraze


People also ask

Where is bash_profile stored Mac?

bash_profile for Mac Users. There is a hidden file in your Mac's user directory named . bash_profile. This file is loaded before Terminal loads your shell environment and contains all the startup configuration and preferences for your command line interface.

How do I open a profile on a Mac?

On your Mac, choose Apple menu > System Preferences, then click Profiles . If you haven't installed any configuration profiles, Profiles preferences isn't available. Select a profile in the Profiles list to view information about it.


1 Answers

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
like image 135
Cypress Frankenfeld Avatar answered Oct 16 '22 11:10

Cypress Frankenfeld