Mac OSX Lion Terminal ~/.bash_profile Permission Denied

0

I am an extreme beginner at Terminal. I was trying to root my Android phone. I altered something after typing in ~/.bash_profile. I did it incorrectly. Now I need to reenter it to do it correctly and I am being denied permission. I have no idea what to do.

I type in

~/.bash_profile 

and I receive

-bash: /Users/Nader/.bash_profile: Permission denied

If you could put the answer in babysteps that would be great because I have little to no idea what I am doing.

Nader

Posted 2011-12-19T06:38:58.813

Reputation: 1

Answers

4

Assuming .bash_profile is available on your Mac:

Open any text editor, such as TextEdit. Press Cmd+O to open the Open File dialog. Press Cmd+ (Up Arrow) until you reach to your Home Directory. Press Cmd + Shift + . (dot) to show all hidden files and folders.

Select .bash_profile in your home directory and edit its contents. It's probably best to delete all of the content (after storing it somewhere, just in case), the file is optional and contains personal preferences.

or just replace with following line export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin"

Daniel Beck

Posted 2011-12-19T06:38:58.813

Reputation: 98 421

@Nader just use "cmd + ↑" to go back to your home directory, where you'll find .bash_profile – Mohit G. – 2019-06-03T09:27:00.907

Thanks for the response. I don't understand how to select .bash_profile where exactly in my home directory is it supposed to be located? – Nader – 2011-12-19T07:02:52.737

It's supposed to be right there. Unless you actually haven't created the file yet. If it's not there, you can just create it with that name. It might be good to know what exactly you typed before you had the issue. And give us the output of ls -la ~. – slhck – 2011-12-19T07:30:51.060

1

It's saying 'permission denied' because you are trying to run the .bash_profile as a command. when you type ~/.bash_profile you haven't given it a command to execute against the file.

Because the filename starts with a '.' it is a hidden file. Daniel Beck told you how to find the file in the file listing of TextEdit.

in a terminal window if you type ls -la it will give you a listing (ls) of all the files in a directory with a long format (-l) which provides more information about the files including ownership privileges. the (-a) will show all files, including the hidden ones.

if you type edit .bash_profile in a terminal window, it will open the file in a text editor. Also you can cat .bash_profile which will output the contents of the file directly into the terminal window so that you can review it, (you can't edit it, but you can at least look at it).

More help from the folks here will come if you can at least give the output of the file listing command: ls -la for the .bash_profile file.

lhagemann

Posted 2011-12-19T06:38:58.813

Reputation: 286

There's no edit on OS X. open -e works though. – Daniel Beck – 2011-12-19T18:07:09.240