All commands are not working on mac os x lion [closed] - shell

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I am facing a problem, i can't run even a single command on my mac osx lion terminal, even "ls" command, when i print $PATH variable, found
My-Mac:/ Mac$ echo $PATH
/usr/local/git/bin
Please help me if you have guys have any solution for that.
thanks

You should probably ask this question on superuser.stackexchange.com (for "power user"-type questions; instead of here, which is meant for programming questions).
But I'll help you out a little bit: beyond the .tcshrc file you should also have for your home directory, also check to see if you have any files at /usr/share/tcsh/examples. That is where the "global" tcsh settings (including PATH) should be found.
If you don't have a .tcshrc file... create one in TextEdit and add something like:
set path = ( \
~/bin \
/usr/local/bin /usr/bin /bin \
/usr/local/sbin /usr/sbin /sbin \
)
to it.
Oh yeah, lastly... I'm assuming you're using tcsh since that's the usual Macintosh shell. You can make sure by typing in echo $SHELL at the command line.

Related

Export command not found on mac terminal [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I added something to my bash_profile while trying to add Playframework to my path and something got messed up badly.
I added the following line to my .bash_profile
export PATH=$PATH:the path to my play excitable
then I saved everything and restarted my terminal. I can no longer do anything from my terminal. I can't cd into any directory, I can no longer find java, I can't open vi or nano.
I found this thread on SuperUser that suggested opening a different terminal and changing the bash profile.
I tried opening bash by typing
/bin/bash
and I was successfully able to open another terminal but I still don't have access to any of the regular unix commands. I still wasn't able to open vi or nano to remove the line that is causing the problem.
I tried downloading a new terminal application without any luck.
I tried turning on hidden files so that I can just change the file with a text editor by running the following command:
defaults write com.apple.finder AppleShowAllFiles TRUE
but since my terminal isn't working that didn't work either.
How can I fix my computer.
While this is offtopic for stackoverflow, it's also pretty simple to fix:
Start Terminal.app.
Reset $PATH:
$ export PATH=/bin:/usr/bin:/usr/local/bin
Fix ~/.bash_profile:
$ vi ~/.bash_profile
Or you can avoid setting $PATH at all with:
$ /usr/bin/vi ~/.bash_profile

Emacs gone from Mac OS Terminal - Only GUI version left [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I have recently removed Emacs from my Mac OSX Yosemite, and have a beginner's beginner's problem in re-installing it and running it from the terminal. I can open the Emacs app GUI from the Applications folder, but cannot use Emacs from within the Terminal whatsoever.
I removed the old version of Emacs by using the command:
$ sudo rm /usr/bin/emacs
$ sudo rm -rf /usr/share/emacs
Then I installed the newest version of Emacs through Homebrew, using the code
$ brew install emacs --with-cocoa.
Now, when I type the command emacs in the terminal, I get "/usr/local/bin/emacs: No such file or directory."
I tried to add the following lines in a file named "emacs" in /usr/local/bin:
#!/bin/sh
/Applications/Emacs.app/Contents/MacOS/Emacs "$#"
But now, when I type the command emacs in the terminal I get: "-bash: /usr/local/bin/emacs: Permission denied"
Any suggestions? Thanks in advance!
My crystal ball tells me that you forgot to chmod +x /usr/local/bin/emacs.
You don't need a script, use a symbolic link.
$ ln -s /Applications/Emacs.app/Contents/MacOS/Emacs /usr/bin/emacs

How to restore .bash_profile on a mac? None of my unix terminal are working [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I added something to my bash_profile while trying to add Playframework to my path and something got messed up badly.
I added the following line to my .bash_profile
export PATH=$PATH:the path to my play excitable
then I saved everything and restarted my terminal. I can no longer do anything from my terminal. I can't cd into any directory, I can no longer find java, I can't open vi or nano.
I found this thread on SuperUser that suggested opening a different terminal and changing the bash profile.
I tried opening bash by typing
/bin/bash
and I was successfully able to open another terminal but I still don't have access to any of the regular unix commands. I still wasn't able to open vi or nano to remove the line that is causing the problem.
I tried downloading a new terminal application without any luck.
I tried turning on hidden files so that I can just change the file with a text editor by running the following command:
defaults write com.apple.finder AppleShowAllFiles TRUE
but since my terminal isn't working that didn't work either.
How can I fix my computer.
While this is offtopic for stackoverflow, it's also pretty simple to fix:
Start Terminal.app.
Reset $PATH:
$ export PATH=/bin:/usr/bin:/usr/local/bin
Fix ~/.bash_profile:
$ vi ~/.bash_profile
Or you can avoid setting $PATH at all with:
$ /usr/bin/vi ~/.bash_profile

How to change the terminal prompt to just current directory? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I am using a Macbook Pro, and I wanted to change it to the current directory and a dollar sign prompt in Terminal. I've already looked at these resources to try and solve this issue.
I tried modifying the ~/.bashrc file and saving it but it did not seem to work.
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
export PS1="\W$ ”
The last line is what I added to change the prompt.
This should be done in .bash_profile, not .bashrc.
nano ~/.bash_profile
Add a line containing this:
export PS1="\W\$ "
.bashrc is ONLY excuted when starting a sub-shell. bash login shell uses the following initialization scripts:
.bash_profile
.bash_login
.profile
You need to escape the dollar sign. Like this:
$ PS1="\W\$ "
~$ cd tmp
/Users/philip/tmp
tmp$
And once you change your .bashrc you either need to logout/back-in or . ~/.bashrc to re source it.
I would humbly recommend not doing this. Having a full path is very useful as 'tmp' directories could be anywhere. Consider using "\w" which does relative path (ie. uses ~ to represent HOME)

Zsh tab-completion for "cd .." [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
How can I configure the Zsh tab-completion such that when I type cd ..<TAB> it expands to cd ../ and after pressing <TAB> again proposes the folders in the parent directory for completion?
E.g. it should show the same behavior as when typing for example cd Documents<TAB> which expands to cd Documents/ and after pressing <TAB> again proposes the folders in Documents for completion.
As a starting point for configuration I use an empty .zshrc and Zsh 4.3.9 from MacPorts.
Same problem with debian unstable, Ubuntu jaunty, both ship zsh 4.3.9. I know of multiple people with different configurations.
After reading http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=514152 I added
zstyle ':completion:*' special-dirs true
to my config and now everything works fine again.
Put this into your ~/.zshrc:
autoload -Uz compinit
compinit
There is also a project with zsh functions/configurations for Mac OS X on http://code.google.com/p/zsh-templates-osx/ . Personally I think it's an overkill to use the whole package. But found it useful to cherry pick some tricks, functions, completions etc. and create my own .zshrc
This may or may not be a useful answer - switch to bash, which does what you want out of the box.

Resources