I have installed Google's Go language on FreeBSD 8.1, added the path to the compiler/interpreter to my PATH in .profile and now am trying to reload it.
$ . ~/.profile
And here is what i get:
/usr/local/bin/.: Permission denied.
I also tried to use source instead of ., but that gives an error per line of the file, like HOME=/root: Command not found.
What can I do about it? And is this the right place to ask such questions?
I believe that the right way to extend the user's path is to edit user's shell configuration file. The default shell in FreeBSD for regular users is tcsh, for which you can use the ~/.cshrc configuration file.
To modify the PATH environment variable, create or edit .cshrc file in your home directory and put there the following example line:
set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin)
Then run:
$ source ~/.cshrc
verify your setting with:
$ echo $path
/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin /home/danger/bin
The default interactive shell on FreeBSD is tcsh. Its syntax is different from that of sh. It is only the latter that uses ~/.profile.
The right way to extend the path is to modify it in the default profile in /etc/login.conf. Then run cap_mkdb /etc/login.conf as root, log out and log in again.
Related
I am trying to open up files from my terminal using atom. Which resulted in -bash: atom: command not found. I then followed, installing the shell commands from the editor. That resulted in "EEXIST: file already exists, mkdir '/usr/local/bin'" . I've previously tried to follow other recommendations on how to add the subl alias and I guess I tried way too many things, that I didn't understand. Could I have messed up my $PATH ?
When I echo my path this is what it is /bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin.
My bash_profile looks like this when I opened it with nano:
export PATH=/bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:$PATH
export EDITOR='subl -w'
I don't remember if I added that first line when I tried adding subl.
Should I remove that? I'm also using a MacOS High Sierra.
UPDATE
I removed what I had previously added in my .bash_profile and my path is now: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin.
I then ran the command: sudo ln -s /Applications/Atom.app/Contents/Resources/app/atom.sh /usr/local/bin/atom but got a ln: /usr/local/bin/atom: No such file or directory error
You can remove the export PATH statement from your .bash_profile; it doesn't add anything that isn't already there. (Except maybe /usr/local/sbin, but I would remove that until you can demonstrate a need for it.)
Initially, PATH will include the directories listed in /etc/path:
% cat /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
Any of your shell configuration files can add to the PATH. Assuming you haven't significantly altered your configuration, /etc/profile will run path_helper to add any directories listed in files under /etc/paths.d.
You only need to update PATH if you need to add a directory that is not already there. If atom is located in one of the above paths, you don't need to do anything. It sounds like you attempted to create /usr/local/bin when it already (as it should) exists, then perhaps did not ultimately create the symlink for atom under /usr/local/bin.
Try running just the ln command from the question you linked (using sudo if necessary), then confirm that /usr/local/bin/atom does indeed exist.
I tried to install laravel Framework in my mac OSX 10 .And I ended modifying my ~/.bash_profile to add the laravel command. laravel command seems to work normally .But another problem came out . ls ,sudo ...and other shell commands does not work .
-bash: ls: command not found
My bash.profile file contains the two links
export PATH="/Applications/MAMP/bin/php/php5.6/bin"
export PATH="$PATH:$HOME/.composer/vendor/bin"
check in ~/.bash_profile if this PATHs exist
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
your complete line should looks like this
export PATH=/Applications/MAMP/bin/php/php5.6/bin:$HOME/.composer/vendor/bin:/opt/local/bin:/opt/local/sbin:$PATH
reboot needed.
The binaries for the above mentioned utilities for debian distribution are usually in /bin or /usr/bin directory. Of course exporting path won't help if the binaries are not there.
There could be one simple approach to it -
Check for the location of binaries and then export the path in the bash_profile or .bashrc.
Run the bashrc script (. ~/.bashrc) following you may not require a reboot.
echo $PATH gives me
/Library/Frameworks/Python.framework/Versions/3.4/bin:/Applications/Sublime Text 2.app/Contents/SharedSupport/bin:/Users/pathreskoo/anaconda/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin
but when I want to change the order of /usr/local/bin to the front of /Library/Frameworks/Python.framework/Versions/3.4/bin, I type
sudo emacs /etc/paths
I only get
/usr/local/bin:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
How can I insert /usr/local/bin in front of my PATH?
You can set your PATH in the file .bash_profile, which is in your home directory.
More specifically, you can simply add the following line to the end of that file
export PATH=/usr/local/bin:$PATH
This results in /usr/local/bin being prepended to the existing PATH. In other words, the folder /usr/local/bin is inserted in front of your PATH, and so it would have the highest priority. You can also append a folder to your path by doing
export PATH=$PATH:/usr/local/bin
In general, you can set the order of the folders or files that you export in a similar way as the following:
export PATH=/usr/local/bin:/Applications/Sublime Text 2.app/Contents/SharedSupport/bin:/Users/pathreskoo/anaconda/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin
Note: this is not the only place you can set the PATH, but it is a common one.
Your $PATH normally overridden by the initiation part of your shell. Normally follows the system-wide profile (/etc/profile), then user-side profile (if you use bash .profile, .bash_profile, .bashrc) and any source command in these files. The overridden command mainly in .bashrc
Edit you .bashrc file and find $PATH, you may find the export command and delete the path you do not want. export $PATH=/usr/local/bin:$PATH override the command user-wide.
https://github.com/colinmollenhour/modman/blob/master/README.md
I am trying to install modman.
First I install via:
bash < <(curl -s -L https://raw.github.com/colinmollenhour/modman/master/modman-installer)
modman is created at User/Username/bin/modman
I got lost on the next part:
source ~/.profile
I don't have .profile in my directory, so i created one in my user root and I added
export PATH=$PATH:/Users/Username/bin/modman
I am not sure if that is correct, when I cd to my project directory and
do modman init it returns modman: command not found
Why am I getting this message?
You add directories to PATH, not individual binaries.
export PATH=$PATH:/Users/Username/bin
Note the line from the installer that would have updated .profile for you:
echo -e '\nPATH="$HOME/bin:$PATH"' >> $HOME/.profile
(Typically, you might add $HOME/bin to the beginning of the path so that you can override system binaries, but in your case, it doesn't matter since you don't have modman installed outside your home directory.)
Here is my code:
#!/usr/bin/node
console.log('HELLO')
This file has been named test. No extension. If I try running it in my terminal like so
$ test
There is no output. However, if I run
/usr/bin/node test
I get the desired output:
HELLO
Why isn't my script giving the same results?
When you type a command, and it's not an absolute or relative path (like ../test, or /bin/test, or ~/test), then the shell has to search for the executable. It does this by looking in the directories specified in $PATH. You can print it:
> echo $PATH
/usr/local/bin /usr/bin /bin /usr/sbin /sbin
Notice that the current directory . is not in PATH. This is deliberate: if PATH contained ., then it's possible that a command may be accidentally or maliciously overridden by a file in the current directory.
You can ask which command you'd get:
> which test
/bin/test
That's what's being run, and why there's no output.
To run a command that's not in PATH, use an absolute or relative path:
./test
That should fix your problem.