I'm currently running into an issue where I am not able to use makepkg on my server.
I've verified that pacman is installed correctly so I'm assuming this has to have something to do with my environment PATH?
Trying to run makepkg from my bash prompt I just get
-bash: makepkg: command not found
Well, you need the correct path of command...
Try exec echo in $PATH and try export the path command to $PATH.
export PATH=$PATH:/path/of/command
Try reinstalling pacman, like so: sudo pacman -S pacman
Related
I am trying to install the github-pages ruby gem on Linux Mint for use with jekyll.
After running sudo gem install github-pages I get:
WARNING: You don't have /home/max/.gem/ruby/2.3.0/bin in your PATH,
gem executables will not run. Building native extensions. This could
take a while...
ERROR: Error installing github-pages: ERROR: Failed
to build gem native extension.
The curious thing is that my path, as printed by echo $PATH and by sudo echo $PATH both include
/home/max/.gem/ruby/2.3.0/bin
So how do I end up with that warning that it is not in my PATH?
Try:
sudo PATH=$PATH command
It is possible that sudo is scrubbing your path environment variable.
Also if you want to check the path that command with sudo sees run this instead, otherwise $PATH gets extrapolated by current shell.
sudo bash -c 'echo $PATH'
I just tried to use Homebrew and Linuxbrew to install packages on my Ubuntu Server but both failed. This is how I tried to install them:
sudo apt-get install build-essential curl git m4 ruby texinfo libbz2-dev libcurl4-openssl-dev libexpat-dev libncurses-dev zlib1g-dev
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"
I got the following warning:
Warning: /home/tong/.linuxbrew/bin is not in your PATH.
I vi my bash.bashrc in home/etc and add this:
export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
Then I tried brew doctor but got No command 'brew' found. How am I able to use Homebrew on Ubuntu?
As of February 2018, installing brew on Ubuntu (mine is 17.10) machine is as simple as:
sudo apt install linuxbrew-wrapper
Then, on first brew execution (just type brew --help) you will be asked for two installation options:
me#computer:~/$ brew --help
==> Select the Linuxbrew installation directory
- Enter your password to install to /home/linuxbrew/.linuxbrew (recommended)
- Press Control-D to install to /home/me/.linuxbrew
- Press Control-C to cancel installation
[sudo] password for me:
For recommended option type your password (if your current user is in sudo group), or, if you prefer installing all the dependencies in your own home folder, hit Ctrl+D. Enjoy.
I just tried installing it using the ruby command but somehow the dependencies are not resolved hence brew does not completely install. But, try installing by cloning:
git clone https://github.com/Homebrew/linuxbrew.git ~/.linuxbrew
and then add the following to your .bash_profile:
export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
It should work..
as of august 2020 (works for kali linux as well)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
export brew=/home/linuxbrew/.linuxbrew/bin
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile // for ubuntu and debian
The following steps worked for me:
Clone it from github
git clone https://github.com/Homebrew/linuxbrew.git ~/.linuxbrew
Open your .bash_profile file using vi ~/.bash_profile
Add these lines
export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
Then type the following lines in your terminal
export PATH=$HOME/.linuxbrew/bin:$PATH
hash -r
Yes, it is done. Type brew in your terminal to check its existence.
You can just follow instructions from the Homebrew on Linux docs, but I think it is better to understand what the instructions are trying to achieve.
Understanding the installation steps can save some time
Step 1: Choose location
First of all, it is important to understand that linuxbrew will be installed on the /home directory and not inside /home/your-user (the ~ directory).
(See the reason for that at the end of answer).
Keep this in mind when you run the other steps below.
Step 2: Add linuxbrew binaries to /home :
The installation script will do it for us:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Step 3: Check that /linuxbrew was added to the relevant location
This can be done by simply navigating to /home.
Notice that the docs are showing it as a one-liner by adding test -d <linuxbrew location> before each command.
(Read more about the test command in here).
Step 4: Export relevant environment variables to terminal
We need to add linuxbrew to PATH and add some more environment variables to the current terminal.
We can just add the following exports to terminal (wait don't do it..):
export PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin${PATH+:$PATH}";
export HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew";
export HOMEBREW_CELLAR="/home/linuxbrew/.linuxbrew/Cellar";
export HOMEBREW_REPOSITORY="/home/linuxbrew/.linuxbrew/Homebrew";
export MANPATH="/home/linuxbrew/.linuxbrew/share/man${MANPATH+:$MANPATH}:";
export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:${INFOPATH:-}";
Or simply run (If your linuxbrew folder is on other location then /home - change the path):
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
(*) Because brew command is not yet identified by the current terminal (this is what we're solving right now) we'll have to specify the full path to the brew binary: /home/linuxbrew/.linuxbrew/bin/brew shellenv
Test this step by:
1 ) Run brew from current terminal to see if it identifies the command.
2 ) Run printenv and check if all environment variables were exported and that you see /home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin on PATH.
Step 5: Ensure step 4 is running on each terminal
We need to add step 4 to ~/.profile (in case of Debian/Ubuntu):
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >> ~/.profile
For CentOS/Fedora/Red Hat - replace ~/.profile with ~/.bash_profile.
Step 6: Ensure that ~/.profile or ~/.bash_profile are being executed when new terminal is opened
If you executed step 5 and failed to run brew from new terminal - add a test command like echo "Hi!" to ~/.profile or ~/.bash_profile.
If you don't see Hi! when you open a new terminal - go to the terminal preferences and ensure that the attribute of 'run command as login shell' is set.
Read more in here.
Why the installation script installs Homebrew to /home/linuxbrew/.linuxbrew - from here:
The installation script installs Homebrew to
/home/linuxbrew/.linuxbrew using sudo if possible and in your home
directory at ~/.linuxbrew otherwise. Homebrew does not use sudo
after installation. Using /home/linuxbrew/.linuxbrew allows the
use of more binary packages (bottles) than installing in your personal
home directory.
The prefix /home/linuxbrew/.linuxbrew was chosen so that users
without admin access can ask an admin to create a linuxbrew role
account and still benefit from precompiled binaries.
If you do not yourself have admin privileges, consider asking your
admin staff to create a linuxbrew role account for you with home
directory /home/linuxbrew.
Linux is now officially supported in brew - see the Homebrew 2.0.0 blog post. As shown on https://brew.sh, just copy/paste this into a command prompt:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Because all previous answers doesn't work for me for ubuntu 14.04
here what I did, if any one get the same problem:
git clone https://github.com/Linuxbrew/brew.git ~/.linuxbrew
PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$(brew --prefix)/share/man:$MANPATH"
export INFOPATH="$(brew --prefix)/share/info:$INFOPATH"
then
sudo apt-get install gawk
sudo yum install gawk
brew install hello
you can follow this link for more information.
October 2019 - Ubuntu 18.04 on WSL with oh-my-zsh;
the instructions here worked perfectly -
(first, install pre-requisites using sudo apt-get install build-essential curl file git)
finally create a ~/.zprofile with the following contents:
emulate sh -c '. ~/.profile'
Whta to do
cd /home/linuxbrew/.linuxbrew/bin
./brew doctor
You will get what path to export
echo 'export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"' >> ~/.zshrc
I use virtualenvwrapper from apt.
It's working OK with bash but I recently switched to zsh.
Now when I try workon in zsh I get zsh: command not found: workon
Because I'm using oh-my-zsh script/plugins I thought it will be sufficient to add virtualenv and virtualenvwrapper plugins to my .zshrc plugins=.
But it did not help. What else I need to configure to make it work under zsh?
PS to be clear - I still can use bash for this - nothing broken here...
I just test it on ubuntu 14.04 and i had the same problem.
To fix it add this to your .zshrc
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
or run this in terminal
echo source /usr/share/virtualenvwrapper/virtualenvwrapper.sh >> ~/.zshrc
I installed phantomjs on my mac
phantomjs --version
1.9.2
Following the instructions on the casper installation page, I did this
$ git clone git://github.com/n1k0/casperjs.git
$ cd casperjs
$ ln -sf `pwd`/bin/casperjs /usr/local/bin/casperjs
However, i'm getting command not found when I run casperjs. I also installed it via homebrew and got the same result.
Any suggestions?
Update
this is what I get when I type $PATH
-bash: /Users/me/.rbenv/shims:/opt/local/bin:/opt/local/sbin:/Users/me/downloads/mongodb-osx-x86_64-2.4.5/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/MacGPG2/bin: No such file or directory
inside
usr/local/bin, there is (among other things) phantomjs and casperjs. I can run phantomjs --version from anywhere and get the version number. casperjs doesn't work
This is most likely due to the symbolic link not being created.
Try running the command directly: /usr/local/bin/casperjs --version
If this results in another Command not found error, then you should try running
sudo ln -sf `pwd`/bin/casperjs /usr/local/bin/casperjs
to make sure that you actually create the link in the /usr/local/bin directory
However, if it does exist, you should check to make sure that the link is pointing to the correct directory by running
ls -l /usr/local/bin/casperjs
It seems that you got the ln command line parameters switched: first one is the target, second is the link.
Install casperjs using npm
npm install casperjs
Then you can run it using:
node_modules/casperjs/bin/casperjs selftest
I have installed PostgreSQL and it is working ok. However, when I went to restore a backup I got the error -bash: psql: command not found:
[root#server1 ~]# su postgres
[postgres#server1 root]$ psql -f all.sql
bash: psql: command not found
[postgres#server1 root]$
What have I done wrong?
export PATH=/usr/pgsql-9.2/bin:$PATH
The program executable psql is in the directory /usr/pgsql-9.2/bin, and that directory is not included in the path by default, so we have to tell our shell (terminal) program where to find psql. When most packages are installed, they are added to an existing path, such as /usr/local/bin, but not this program.
So we have to add the program's path to the shell PATH variable if we do not want to have to type the complete path to the program every time we execute it.
This line should typically be added to theshell startup script, which for the bash shell will be in the file ~/.bashrc.
perhaps psql isn't in the PATH of the postgres user. Use the locate command to find where psql is and ensure that it's path is in the PATH for the postgres user.
The question is for linux but I had the same issue with git bash on my Windows machine.
My pqsql is installed here:
C:\Program Files\PostgreSQL\10\bin\psql.exe
You can add the location of psql.exe to your Path environment variable as
described in this other answer, and shown in the screenshot below:
After changing the above, please close all cmd and/or bash windows, and re-open them (as mentioned in the comments #Ayush Shankar). If you are using an IDE like Visual Studio Code, please close and re-open the entire IDE (as mentioned in the comments #Somraj Chowdhury)
You might need to change default logging user using below command.
psql -U postgres
Here postgres is the username. Without -U, it will pick the windows loggedin user.
It can be due to psql not being in PATH
$ locate psql
/usr/lib/postgresql/9.6/bin/psql
Then create a link in /usr/bin
ln -s /usr/lib/postgresql/9.6/bin/psql /usr/bin/psql
Then try to execute psql it should work.
In case you are running it on Fedora or CentOS, this is what worked for me (PostgreSQL 9.6):
In terminal:
$ sudo visudo -f /etc/sudoers
modify the following text from:
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
to
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/pgsql-9.6/bin
exit, then:
$ printenv PATH
$ sudo su postgres
$ psql
To exit postgreSQL terminal, you need to digit:
$ \q
Source: https://serverfault.com/questions/541847/why-doesnt-sudo-know-where-psql-is#comment623883_541880
If you are using the Postgres Mac app (by Heroku) and Bundler, you can add the pg_config directly inside the app, to your bundle.
bundle config build.pg --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
...then run bundle again.
Note: check the version first using the following.
ls /Applications/Postgres.app/Contents/Versions/
Check if PostgreSQL is installed or not.
If not you can do the same in ubuntu using this command.
sudo apt update
sudo apt install postgresql postgresql-contrib
there must be two reasons for this either the package is not install or psql is not defined in the PATH
the simple way is to create a link within the /usr/bin or /usr/local/sbin/
First find the the file
sudo find / -name psql
then create soft link
sudo ln -sf /opt/pgpro/1c-14/bin/psql /usr/local/sbin/psql
Sometimes we face this issue when the gem installation command doesn't find the pg client library for various reasons, such as if psql is not in the path.
In those cases, providing the command with the path to pg_config may fix the issue.
gem install pg -v 1.3.5 -- --with-pg-config=/path/to/pg_config
In my case, I faced a similar issue when I installed postgresql#12 with Homebrew in the Rosetta environment.
Following command solved the issue in my case.
gem install pg -v 1.3.5 -- --with-pg-config=/usr/local/Homebrew/Cellar/postgresql#12/12.13/bin/pg_config