I was doing an exercise from the ruby on rails tutorial which involves installing postgresql. Following the instructions from a rails cast linked in the tutorial, I did
brew install postgresql
This errored. On searching online, found a thread on a forum which suggested doing
brew unlink ossp-uuid && brew link ossp_uuid
I don't know what this is achieving. The command failed (I think the first part succeeded). The error:
Could not symlink file: /usr/local/Cellar/ossp-uuid/1.6.2/share/man/man3/uuid.3
/usr/local/share/man/man3 is not writable. You should change its permissions.
What is this about? Why do we need to create this symbolic link?
Thanks in advance!
You don't need sudo to work with brew read here.
The main problem is your own permission on /usr/local folder to execute these actions.Try this (make sure that you login as administrator role):
sudo chmod go+w /usr/local
Then try again:
brew unlink ossp-uuid && brew link ossp-uuid
and:
brew install postgresql
You likely need to use sudo before the command.
Alternatively, postgres can be installed from an installer from their site: Mac OS X installer
Postgresql is already installed on Lion.
Related
Official page do not mention such case. But many users need only psql without a local database (I have it on AWS). Brew do not have psql.
You could also use homebrew to install libpq.
brew install libpq
This would give you psql, pg_dump and a whole bunch of other client utilities without installing Postgres.
Unfortunately since it provides some of the same utilities as are included in the full postgresql package, brew installs it "keg-only" which means it isn't in the PATH by default. Homebrew will spit out some information on how to add it to your PATH after installation. In my case it was this:
echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.zshrc
Alternatively, you can create symlinks for the utilities you need. E.g.:
ln -s /usr/local/Cellar/libpq/10.3/bin/psql /usr/local/bin/psql
Note: used installed version instead of 10.3.
Alternatively, you could instruct homebrew to "link all of its binaries to the PATH anyway"
brew link --force libpq
but then you'd be unable to install the postgresql package later.
libpq 11.2
MacOS & zsh or bash
below works
install libpq
brew install libpq
update PATH
if use zsh:
echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
if use bash:
echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
Homebrew only really has the postgres formula, and doesn't have any specific formula that only installs the psql tool.
So the "correct way" to get the psql application is indeed to install the postgres formula, and you'll see toward the bottom of the "caveats" section that it doesn't actually run the database, it just puts the files on your system:
$ brew install postgres
==> Downloading https://homebrew.bintray.com/bottles/postgresql-9.6.5.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring postgresql-9.6.5.sierra.bottle.tar.gz
==> /usr/local/Cellar/postgresql/9.6.5/bin/initdb /usr/local/var/postgres
==> Caveats
<snip>
To have launchd start postgresql now and restart at login:
brew services start postgresql
Or, if you don't want/need a background service you can just run:
pg_ctl -D /usr/local/var/postgres start
==> Summary
🍺 /usr/local/Cellar/postgresql/9.6.5: 3,269 files, 36.7MB
Now you can use psql to connect to remote Postgres servers, and won't be running a local one, although you could if you really wanted to.
To verify that the local postgres daemon isn't running, check your installed homebrew services:
$ brew services list
Name Status User Plist
mysql stopped
postgresql stopped
If you don't have Homebrew Services installed, just
$ brew tap homebrew/services
...and you'll get this functionality. For more information on Homebrew Services, read this excellent blog post that explains how it works.
If you truly don't need postgresql then you don't even have to alter your path to use libra, just link libpq. The docs say the only reason it isn't is to avoid conflicts with the PostgreSQL package.
brew uninstall postgresql
brew install libpq
brew link --force libpq
Install libpq:
brew install libpq
Then, create a symlink:
sudo ln -s $(brew --prefix)/opt/libpq/bin/psql /usr/local/bin/psql
Hope it helps.
I found all of these really unsatisfying, especially if you have to support multiple versions of postgres. A MUCH easier solution is to download the binaries here:
https://www.enterprisedb.com/download-postgresql-binaries
And simply run the executable version of psql that matches the database you're working against without any extra steps.
example:
./path/to/specific/version/bin/psql -c '\x' -c 'SELECT * FROM foo;'
Found so many useful answers here, but a bit outdated since homebrew moved the installation files to /opt/homebrew/Cellar/libpq/15.1. After libpq is installed with brew install libpq you can run below command to see new location
brew link --force libpq
Then you can add it to your zshrc with
echo 'export PATH="/opt/homebrew/Cellar/libpq/15.1/bin:$PATH"' >> ~/.zshrc
You could try brew install postgresql
But this provides a nice GUI to manage your databases https://postgresapp.com
I am trying to download Hydra in Terminal with Homebrew on my imac but it gives me this error:
You must `brew link makedepend` before hydra can be installed
And when I run:
brew link makedepend
It says:
Error: Could not symlink .
/usr/local/opt is not writable.
And if i use sudo it says:
Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
Can someone help me thank you!
Run brew update first, and then brew doctor. It will likely ask you to use chmod on /usr/local/. Follow its instructions.
I installed lua on my OSX 10.10 machine using brew install lua. The version that got installed was 5.2.4. LuaRocks was installed along with the lua package. But when i run luarocks install <package_name> i get Error: ##HOMEBREW_PREFIX## does not exist and your user does not have write permissions in. i tried using sudo luarocks install <package_name> as well, but it gives the same error. How to fix this ?
Please Help.
Thanks
This was a bug in the way we relocate text files to ensure wider bottle portability for non-/usr/local users.
It was resolved a couple of weeks back, July 31st I believe. Presuming your Homebrew is in a standard location, if you do:
rm /usr/local/etc/luarocks52/config-5.2.lua && brew update && brew reinstall lua
The problem should be resolved now. Apologies!
I had the same problem when using the luarocks when installed with homebrew, try installing luarocks again like this:
$ wget http://luarocks.org/releases/luarocks-2.2.1.tar.gz
$ tar zxpf luarocks-2.2.1.tar.gz
$ cd luarocks-2.2.1
$ ./configure; sudo make bootstrap
I took this code snippet from here: https://luarocks.org/
I managed to install all the modules that I required without problems after doing this.
I have installed Qmake using brew.
brew install qt
The results which the terminal brings is:
Warning: qt-4.8.6 already installed, it's just not linked
This is a problem with brew to install correct the things? because I am having the same "not linked" problem with PostgreSQL.
Thks
I found the problem:
The Brew can't write to the folder /usr/local/lib/
So I used the command: sudo chown -R $USER /usr/local/lib
I found a similar error here: Brew doctor says: "Warning: /usr/local/include isn't writable."
But this problem was with another folder permission.
The Brew can't write to the folder
/usr/local/lib/
So I used the command:
sudo chown -R $USER /usr/local/lib
After need uninstall and install qt again. (If you run reinstall the problem will continuous)
brew uninstall qt
brew install qt
I found a similar error here:
Brew doctor says: “Warning: /usr/local/include isn't writable.”
But this problem was with another folder permission.
Try
brew link qt
Which should tell brew to link the package.
If that doesn't work, someone else had a similar problem here: Error: The 'brew link' step did not complete successfully
I installed ruby via \curl -L https://get.rvm.io | bash -s stable and did rvm install 1.9.2 doing this creates and error
Installing requirements for osx, might require sudo password.
fatal: Unable to create '/usr/local/.git/index.lock': Permission denied
Error: Failure while executing: git checkout -q master
Failed to update Homebrew, follow instructions here:
https://github.com/mxcl/homebrew/wiki/Common-Issues and make sure `brew update` works before continuing.
Upon doing a which git it shows it's installed in /usr/bin/git yeah homebrew keeps trying to reference /usr/local/.git. I tried unistalling homebrew so I can do a fresh install using what's listed at homebrew gist. All seemed well but doing a which brew still shows it as /usr/local/bin/brew so I tried to manually uninstall it by doing it one by one.
One thing to note is I never had a Cellar folder, why I don't know. While doing a brew prune I noticed a lot of macport items are starting to ask if I should override them.
Is it typical to of ran the uninstall script but still have the brew commands available or the dirs?
Why is it that homebrew needs root access to /user/local/ to work, this is extremely bad.
That /usr/local/.git it's referencing is not the git executable, but the config file for the repository it's trying to set up under /usr/local/. It's trying to write to that file.
To run homebrew you need write permissions to /usr/local as the user you'r going to run brew as. Homebrew's recommended method is to adjust the ownership and permissions on /usr/local to allow you to write to it from your regular user account or a dedicated homebrew account, instead of using sudo. This is done as part of the homebrew installation script, typically by putting you in the admin group and making /usr/local group-writable.
To fix this, check the owner and permissions on /usr/local/ and /usr/local/.git and make sure you can write to them (and the rest of the /usr/local/ hierarchy) as the user that you're running brew and RVM commands as.
Ended up just doing a sudo $USER as I really could not find any other approach to fixing this.