PDA

View Full Version : .bashrc: No such file or directory




gravity black
Feb 23, 2012, 07:19 PM
I think this is a fairly simple question- it probably only barely qualifies for the "programming" forum.

A few months ago I edited some file so that when I open terminal the prompt gives certain information, (i.e. the time, my name, the computer name), in a certain color. This works fine when I either first open terminal, or open a new window, but for some reason when I create a new tab in terminal, it says:

-bash: .bashrc: No such file or directory

Everything then works fine, but with default settings, (i.e. none of my settings from that file)

My question is: what file might this have been, and why does it work with a new window but not a new tab?

Thanks!



Negritude
Feb 23, 2012, 07:57 PM
In Terminal, look under Preferences -> Startup and see what it says under "New Tabs Open With". It should be the same as "New Windows Open With". If it's not, fix it so that it is.

KnightWRX
Feb 23, 2012, 08:02 PM
In Terminal, look under Preferences -> Startup and see what it says under "New Tabs Open With". It should be the same as "New Windows Open With". If it's not, fix it so that it is.

Or better, fix whatever script is sourcing .bashrc in the CWD (current working directory) rather than the user's HOME directory so that any of the settings in Terminal work properly and your .bashrc gets read.

BTW, not a programming question at all.

MiniMoney
Feb 23, 2012, 09:11 PM
This happens because the terminal window opens to the same directory you were in the last time you used Terminal. .bashrc isn't located in that directory so it it can't find it. If you always do the command "cd" before quitting Terminal, you won't have the problem.

P.S. Didn't see KnightWRX's reply when I posted mine. His is the best solution.

SlugBlanket
Feb 24, 2012, 06:25 AM
I think this is a fairly simple question- it probably only barely qualifies for the "programming" forum.

A few months ago I edited some file so that when I open terminal the prompt gives certain information, (i.e. the time, my name, the computer name), in a certain color. This works fine when I either first open terminal, or open a new window, but for some reason when I create a new tab in terminal, it says:

-bash: .bashrc: No such file or directory

Everything then works fine, but with default settings, (i.e. none of my settings from that file)

My question is: what file might this have been, and why does it work with a new window but not a new tab?

Thanks!

In addition to what the other posters have said the file that you probably edited was located in your home directory and was probably either .profile or .bash_profile. You don't need both files, just one so do a listing to see which file you have.

I'm guessing you probably also wanted to know this to refresh your memory of what you actually put in the file. These 2 files if present are read at login (starting Terminal) but are not read when you start a new subshell. .bashrc is read when you start a new sub-shell. It's probably a good idea to make sure that any customisations you have in either .profile or .bash_profile are also present in .bashrc. That's just my personal preference, others may have perfectly valid reasons for not doing this.

gravity black
Mar 6, 2012, 05:22 PM
Hey everyone, thanks for the replies. Negritude's solution worked perfectly, but as some of you pointed out, there are probably other errors that might surface in other ways because of how I have things set up, and I'd like to get them right.


In addition to what the other posters have said the file that you probably edited was located in your home directory and was probably either .profile or .bash_profile. You don't need both files, just one so do a listing to see which file you have.

I don't have either of these in my home directory.

midniter
Jun 6, 2012, 08:53 AM
OMG can u people speak in english :(

Im trying to follow these instruction to install PIL & PYTHON
and i dont even know my azz from my head anymore :(

The idea was to get Shared@2x.artwork file from Iphone 4
Extract the .png files from it & edit them in photoshop
Hopefully customize... some stuff on the iphone 4 (5.1.1)
__________________________________
In Terminal, create a symbolic link for the system's Python.framework in the location expected by the pythonmac.org tools, like so:

cd /Library/Frameworks
sudo ln -s /System/Library/Frameworks/Python.framework/ Python.framework

Now run the PIL installer. It should work!

You also need to add the PIL install location to PYTHONPATH. Stick the following in ~/.bashrc. ( i dont know what it means to stick... this into that... i cannot even find the ~/.bashrc folder/file... whatever it is )

export PYTHONPATH=/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/

Now open a new terminal window, and type:

python -c "from PIL import Image"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named PIL
_________________________________________________
I googled for "~/.bashrc location" and i got to this thread... but im not able to follow what you guys are discussing above :( plz help

kryten2
Jun 6, 2012, 01:14 PM
@midniter
Make sure you've done everything you needed to do eg create the symbolic link, run the PIL installer etc

In Terminal :

echo "export PYTHONPATH=/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/" >> .bashrc
. .bashrc
python -c "from PIL import Image"

I suggest you read the Login Scripts portion of this link : http://developer.apple.com/library/mac/#documentation/OpenSource/Conceptual/ShellScripting/BeforeYouBegin/BeforeYouBegin.html

midniter
Jun 7, 2012, 06:52 AM
Kryten @ first of all.. thank you for considering my prob :)
I am not a computer person... I dont know codes or languages lingo... just a reg mac user... and I may have bitten into more than i can chew :P

All I want is to open shared@2x.artwork file ... extract the .png files... edit them in photoshop... put them back into an shared@2x.artwork file.. put this file back in iphone (SSH) .. and hopefully see some visual changes in my iphone 4s
_____________________________________________

/Applications/Python 2.7
/Users/W_I_K_I_D/__i__/_Artwork/Artwork/PIL_1.1.7
~/.bashrc
____________________________________________
Here are the results after i put these 3 lines in the Terminal

twiztid:~ W_I_K_I_D$ echo "export PYTHONPATH=/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/" >> .bashrc
twiztid:~ W_I_K_I_D$ . .bashrc
twiztid:~ W_I_K_I_D$ python -c "from PIL import Image"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named PIL
twiztid:~ W_I_K_I_D$
___________________________________________

kryten2
Jun 7, 2012, 09:47 AM
I am not a computer person... I dont know codes or languages lingo... just a reg mac user... and I may have bitten into more than i can chew :P

Doesn't really matter. Problems are there to be solved. I'll admit I've never heard of PIL before or that artwork file you're trying to open and I don't have an iPhone and I'm not a python programmer. I'm guessing you're trying to follow a tutorial of some kind. Can you provide me with a link?

A few questions :

1) What version of OS X are you running?
2) I can see you've changed the export line. Did you install python2.7?
3) What's the output when you run python in Terminal?

Edit : Done a quick Google and PIL is the Python Imaging Library and can be installed on Leopard with Python 2.5.1. I'll give it a go.
Edit : Done some more Googling and apparently you're trying to hack some copyrighted materials on your iPhone. I think that goes against Macrumors forum policies and I don't wanna get banned by offering assistance to that. Sorry, perhaps try this forum : http://forums.macrumors.com/forumdisplay.php?f=105
Edit : Installing PIL took me 15 seconds. I'll offer assistance with that but like stated above NOT with the artwork stuff.

Python should be in /System/Library/Frameworks/Python.framework/Versions/2.7/
PIL should be in /System//Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL