.bashrc: No such file or directory

Discussion in 'Mac Programming' started by gravity black, Feb 23, 2012.

  1. gravity black macrumors newbie

    Oct 18, 2011
    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?

  2. Negritude macrumors 6502

    Jul 14, 2011
    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.
  3. KnightWRX macrumors Pentium


    Jan 28, 2009
    Quebec, Canada
    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.
  4. MiniMoney macrumors newbie

    Jul 22, 2011
    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.
  5. SlugBlanket macrumors regular

    Mar 5, 2011
    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.
  6. gravity black thread starter macrumors newbie

    Oct 18, 2011
    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.

    I don't have either of these in my home directory.
  7. midniter macrumors regular


    Feb 2, 2009
    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
  8. kryten2, Jun 6, 2012
    Last edited: Jun 6, 2012

    kryten2 macrumors 6502a

    Mar 17, 2012
  9. midniter macrumors regular


    Feb 2, 2009
    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
    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$

  10. kryten2, Jun 7, 2012
    Last edited: Jun 7, 2012

    kryten2 macrumors 6502a

    Mar 17, 2012
    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

Share This Page