I recently uninstalled Xcode 4.2 and re-installed Xcode 4.3.1. Command Line Tools are installed. I then installed MacPort using “dmg” disk images for Lion from macports.org. Since, I was getting sudo: port: command not found after every use of port, I followed this and this post to create a .bash_profile file(wasn't present earlier) and then put in it the following but to no avail.
export PATH=$PATH:/opt/local/bin
export MANPATH=$MANPATH:/opt/local/share/man
export INFOPATH=$INFOPATH:/opt/local/share/info
Following this post
➜ ~ git:(master) ✗ rvm install 1.8.7 --with-openssl-dir=/opt/local
You requested building with '/usr/bin/gcc-4.2' but it is not in your path.
➜ ~ git:(master) ✗ vi .rvmrc
rvm_archflags="-arch x86_64"
export CC="/usr/bin/gcc-4.2"
export CFLAGS="-O2 -arch x86_64"
export LDFLAGS="-L/opt/local/lib"
export CPPFLAGS="-I/opt/local/include"
Renaming .bash_profile to .profile
➜ ~ git:(master) ✗ vi .bash_profile
➜ ~ git:(master) ✗ mv .bash_profile .profile
➜ ~ git:(master) ✗ mv .profile
usage: mv [-f | -i | -n] [-v] source target
mv [-f | -i | -n] [-v] source ... directory
➜ ~ git:(master) ✗ mv -f .bash_profile .profile
mv: rename .bash_profile to .profile: No such file or directory
➜ ~ git:(master) ✗ port
zsh: correct 'port' to 'pr' [nyae]? n
zsh: command not found: port
➜ ~ git:(master) ✗ which port
port not found
➜ ~ git:(master) ✗
.profile content:
export PATH=$PATH:/opt/local/bin
export MANPATH=$MANPATH:/opt/local/share/man
export INFOPATH=$INFOPATH:/opt/local/share/info
First, you might need to edit your system's PATH
sudo vi /etc/paths
Add 2 following lines:
/opt/local/bin
/opt/local/sbin
Reboot your terminal
Make sure to delete ~/.bash_profile and ~/.bash_login so that .profile can work. This worked for me http://johnnywey.wordpress.com/2008/04/17/fixing-bash-profile-in-os-x/
I found the answer in the official website
$ vi ~/.profile
# add the following line
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
And now restart the terminal or type source !$ (equivalent to source ~/.profile)
You could try to source your profile file to update your environment:
$ source ~/.profile
if you use zsh.please add flowing string to the line 'export PATH="..."' in file '~/.zshrc'
:/opt/local/bin:/opt/local/sbin
On my machine, port is in /opt/local/bin/port - try typing that into a terminal on its own.
If you have just installed macports
just run and it should work
source ~/.bash_profile
What do you get from running which port as your regular user account? Try it from a freshly opened terminal. Try again after renaming .bash_profile to .profile. Can you run port as a regular user, even with no arguments?
You can quite simply add the line:
source ~/.profile
To the bottom of your shell rc file - if you are using bash then it would be your ~/.bash_profile if you are using zsh it would be your ~/.zshrc
Then open a new Terminal window and type ports -v you should see output that looks like the following:
~ [ port -v ] 12:12 pm
MacPorts 2.1.3
Entering interactive mode... ("help" for help, "quit" to quit)
[Users/sh] > quit
Goodbye
Hope that helps.
there might be the situation your machine is managed by Puppet or so. Then changing root .profile or .bash_rc file does not work at all.
Therefore you could add the following to your .profile file. After that you can use "mydo" instead of "sudo". It works perfectly for me.
function mydo() {
echo Executing sudo with: "$1" "${#:2}"
sudo $(which $1) "${#:2}"
}
Visit my page: http://www.danielkoitzsch.de/blog/2016/03/16/sudo-returns-xyz-command-not-found/
I faced this as an issue with port trees. MacPorts offers a solution here, which worked for me and does not imply changing your environment variables.
Related
I run the command source ~/.bash_profile and get the following error:
$ source ~/.bash_profile
-sh: /Users/chaklader/.sdkman/contrib/completion/bash/sdk: line 37: syntax error near unexpected token `<'
-sh: /Users/chaklader/.sdkman/contrib/completion/bash/sdk: line 37: ` done < <(curl --silent "${SDKMAN_CANDIDATES_API}/candidates/all")'
The login shell that I use is bin/sh:
Whats the issue here and how to solve it?
This is how I solved the issue with the provided steps:
Install Homebrew from the docs on their homepage
Install Git using Homebrew (optional, but nice to have a more up-to-date git)
brew install git
Now install bash:
brew install bash
Add this install of bash to the allowed shells list:
echo '/usr/local/bin/bash' | sudo tee -a /etc/shells;
Homebrew installs things to /usr/local/Cellar/ by default, then symlinks any binaries to /usr/local/bin, so you've now got the latest bash sitting at /usr/local/bin/bash
Finally, change your shell to use this new one:
chsh -s /usr/local/bin/bash
Open a new terminal window/tab, and run these commands to double-check your work:
$ echo $SHELL
/usr/local/bin/bash
$ echo $BASH_VERSION
5.1.8(1)-release
This also solved the issue for running the source ~/.bash_profile whenever I open a new window in the terminal.
Reference:
The answer is from here How do I install Bash >= 3.2.25 on Mac OS X 10.5.8? by user jeffbyrnes
Python3.6 are installed in /Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m
But >>python3.6 does not recognize
Try: >>/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m
Get: zsh: permission denied: /Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m
If you installed from python.org using the .pkg file, it should have symlinked:
/usr/local/bin/python3.6 -> ../../../Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6
(check this by ls -Alh /usr/local/bin | grep "python3.6").
If the symlink doesn't exist you can create it:
ln -s /usr/local/bin/python3.6 /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6
If the symlink does exist but calling python3.6 still doesn't work then check that /usr/local/bin is in your PATH with echo $PATH | grep "/usr/local/bin".
If you don't see :/usr/local/bin: highlighted in the output you need to add this directory to your path in your ~/.zshrc file, with the following:
echo 'export PATH=$PATH:/usr/local/bin' >> ~/.zshrc
be sure to either open a new terminal once you've saved your .zshrc or source ~/.zshrc it.
Install python3.6:
brew unlink python
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb
I want to execute command gclient. I have already included its location in PATH. But I cannot directly execute it by command. Can someone tell me why?
~
❯ echo $PATH
/User/merle/depot_tools:/Users/merle/.nvm/versions/node/v11.10.0/bin:/usr/local/opt/mysql#5.5/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
~
❯ ls depot_tools | grep gclient
README.gclient.md
annotated_gclient.py
gclient
gclient-new-workdir.py
gclient.bat
gclient.py
gclient_completion.sh
gclient_eval.py
gclient_paths.py
gclient_scm.py
gclient_utils.py
~
❯ gclient
zsh: command not found: gclient
~
❯ cd depot_tools
~/depot_tools master
❯ ./gclient
Usage: gclient.py <command> [options]
Meta checkout dependency manager for Git.
Commands are:.......
Take another look at your path:
export PATH=/User/merle/depot_tools:/Users/merle/...
Does your system contain just 1 User or multiple Users???
It should read:
export PATH=/Users/merle/depot_tools:/Users/merle/...
i think you may forget
source ~/.nvm/nvm.sh
if you want automatically load it ,there are two ways
open ~/.zshrc
1.add
source ~/.nvm/nvm.sh
2.or add
export NVM_DIR="/Users/YOUR_USER_NAME(you need use you user name)/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
hope this can help you
ZSH: command not found
The Problem was .zshrc, it was missing.
the solution which worked for me :
You have to create a .zshrc file.
to create use "vim .zshrc" command then insurt your path "export PATH="$PATH:pwd/flutter/bin"
save and completely exit your terminal completely. install gem cocoa pods then accept the license. you are good to go.
I am trying to install Rust by running the following:
sudo curl https://sh.rustup.rs -sSf | sh
I keep getting this following error:
could not write rcfile file: '/Users/pro/.bash_profile'
info: caused by: Permission denied (os error 13
Give a try using this not using sudo:
curl https://sh.rustup.rs -sSf | sh -s -- --help
If that works then probably you could try:
curl https://sh.rustup.rs -sSf | sh -s -- --no-modify-path
If the command with the --no-modify-path option works, you'll have to manually update .bash_profile to include it in your path:
source ~/.cargo/env
The accepted answer worked for me in the working terminal session only, it did not work after restarting my MacBokk Air.
The solution worked with me is:
// Opened .bash_profile file, I used VS code as editor, this the `code` below
Hasans-Air:~ h_ajsf$ sudo code $HOME/.bash_profile
// Add the below to the .bash_profile file
PATH=$PATH:/Users/$USER/.cargo/bin
//Saved the file
//Updated env by:
Hasans-Air:~ h_ajsf$ source $HOME/.bash_profile
//Check for JAVA_HOME
Hasans-Air:~ h_ajsf$ rustup
UPDATE
As shown here:
It sounds like the user running the install script didn't have
permission/wasn't owner of ~/.bash_profile, which is unusual. Maybe
yarn should check and be more helpful, but in any case it's probably a
good idea to run sudo chown whoami ~/.bash_profile
So, I tried the below command:
sudo chown h_ajsf ~/.bash_profile
And everything completed smoothly.
I'm new to Ruby and just installed it following the instructions on this website.
I'm not sure why, but now whenever I open terminal, I get the following error message:
-bash: HOME/.rvm/scripts/rvm: No such file or directory
Is there something I'm missing? As far as I can tell, Ruby is installed correctly and is running fine.
It looks like you put HOME in your .bash_profile instead of $HOME. You should also verify that your .rvm directory exists in your home directory. You could also check the value of $HOME by running echo $HOME in a shell, and it should return something like /home/yourname.
Note: You could change "$HOME" to "~".
This maybe solve your problem:
Before you install RVM, you can input this in your terminal to check server key:
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
Then you can input the following command to install rvm
curl -L https://get.rvm.io | bash -s stable
Just have a try~
You must source the rvm scripts so that they are available to your terminal session
source /usr/local/rvm/scripts/rvm
source ~/.rvm/scripts/rvm
You may want to add it to your .bash_profile or .bashrc file so that they are executed every time you load a terminal window like so:
$ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> .bashrc