开发者

Removing no such file command from OSX terminal startup [duplicate]

开发者 https://www.devze.com 2023-03-18 20:50 出处:网络
This question already has an answer here: How to restore .bash_profile on a mac? None of my unix terminal are working [closed]
This question already has an answer here: How to restore .bash_profile on a mac? None of my unix terminal are working [closed] 开发者_StackOverflow (1 answer) Closed 8 months ago.

Whenever I start a new Terminal session, the window opens up with a command:

'-bash: cd: /Users/yourusername/Library/lejos_nxj: No such file or directory'.

I want to remove that line from coming up on the prompt, so I deleted the Terminal plist file and sent hard resets, but nothing has worked for me so far.

Is there anything I haven't tried yet?


You've probably got something in your ~/.profile, which is automatically executed when you open a Terminal.

If you did not set anything in there, do

rm ~/.profile

in a Terminal and this should disappear.

If you think that something important may be in there, do

open -a TextEdit ~/.profile

(or change TextEdit to your preferred editor) to view and edit the file.


That line is probably in either your ~/.bashrc file or your ~/.profile file. I would check those two files first (and they are both hidden because of the period initial character).

Edit: I just checked my OS X system, and I don't have ~/.bashrc (but you may).


You could try a terminal replacement (Just recently read about this one, iTerm2) it might resolve your problem by using its own default startup settings.

If it is anything like Linux the ~/.bashrc and ~/.profile are used when you open your terminal.


It seems that most people assume it is in some init file but its not clear which are included. Once your shell does come up (ignore errors) -try this:

script
bash -l -x
exit
exit

Now you should have a file called typescript which will have debug info showing most if not all of what the shell has executed when coming up in login mode. You could for instance do grep source typescript to see which files were involved OR you could find refrences to nxj etc.

p.s. I assume your clearing of the plist would clear the preferences, but wouldn't hurt to see if the relevant command is in 'Terminal-> Presences->Settings->Shell->Run Command' for any of the terminal window presets

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号