Default /etc/sysctl.conf settings for Mac OS X Snow Leopard? - macos

I tried to install PostgreSQL 9.1.2 for Mac OS X 10.6 and it asked me to edit the sysctl.conf file inside the /etc/ directory, so it could use more of the shared memory PostgreSQL was asking for.
I went ahead and edited the file, saved it, rebooted and then on the login screen I was asked to login as safe boot for some reason, I logged in and internet did not seem to work and the dock menu was laggy.
So it was pretty obvious this was happening because of the sysctl.conf file that I edited before the reboot, so I went back into the /etc directory and deleted the sysctl.conf file thinking it would auto-create a new sysctl.conf file with the default settings but that wasn't the case even after a reboot.
So now I'm pretty much left without a sysctl.conf file, I read the Mac Developer documentation for this file and it didn't say much. I know I probably shouldn't be messing with files that I don't have a clue about but I really wanted to get PostgreSQL working for my local Ruby on Rails development.
Anything on this topic would be helpful.

I have no /etc/sysctl.conf file on OS X 10.7.2 (Lion).
I suggest you save yourself a lot of headaches and install Postgres using the Homebrew package manager.
The steps, once XCode is installed, are:
Install Homebrew
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
Install Postgres
brew update; brew install postgres
Initialize Postgres
initdb /usr/local/var/postgres
Set Postgres to run automatically
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.1.2/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

Mine contains the following:
kern.sysv.shmmax=134217728
kern.sysv.shmmin=1
kern.sysv.shmmni=256
kern.sysv.shmseg=64
kern.sysv.shmall=32768
I have Lion myself but I don't think there was anything else in it when I was using Snow Leopard.

Related

How to completely remove Postgres from macOS Sierra

I'm on macOS Sierra and have had issues with installing Postgres. I installed it with brew and with the Postgres.app native app from postgresapp.com
After using brew uninstall postgres and following Postgres.app's uninstallation instructions from their website. I'm still seeing the a 'PostgreSQL' user on my machine and when I run sudo find / -name "*postgres*" I still see a lot of output (some is pgAdmin4 and Postico which I'm happy to keep, since I'll be postgres soon), much of which is in the /Library/PostgreSQL/9.6 directory including an actual postgres binary.
Is it safe to just remove the entire directory? How do I completely remove Postgres from my machine so I can start from scratch?
After running brew uninstall postgres, removing postgres.app, and removing the other postgres stuff (that came from https://www.postgresql.org/) in the terminal, my computer worked properly for months and reinstallation went smoothly, too.

How to Start Dropbox After Installing It with Homebrew Cask?

I just started using Homebrew and Cask today to install Unix and OS X applications on my Mac but I don't understand something about Cask. When I run this command,
brew cask install dropbox
I can see that it installs it in /opt/homebrew-cask/Caskroom/dropbox/latest/Dropbox.app and I can see that it has created a symlink ~/Applications/Dropbox.app that points to it, but when I look in Finder at my Applications folder, I don't see it there as I would if I had installed Dropbox from a .dmg file. Also, I don't know how to start Dropbox from this symlink. How do I get Cask to install OS X apps so that I can start them from either the Application folder or via the command line in a terminal session?
just run open ~/Applications/Dropbox.app from your cmd line.
See http://gillesfabio.github.io/homebrew-cask-homepage/ for overview.
Hope that helps
The behavior has changed over the last few months. If you update homebrew to version 1.0 and then run brew cask install dropbox, the application will now be physically moved into /Applications/, and the symlink will be created in ~/Applications/.

How to put psql on the path when using Postgres.app on OS X?

I've installed Postgres93 on my Mac. I can open the application, and "Open psql" through the app which opens up a command line interface with psql.
However, when I type $ which psql nothing is returned. The installation path is /Applications/Postgres93.app. How do I make $ which psql show the correct result?
Mac OS X - Mavericks
PostgreSQL package, I'm not as sure about. I went here and downloaded it - http://postgresapp.com/
I just had postgres installed and was not able to run the psql command until I ran the following command in my terminal:
export PATH="/Applications/Postgres.app/Contents/Versions/9.5/bin:$PATH"
Now the terminal knows where to find postgres when I use the psql command.
Remember to replace the version number '9.5' with your current version.
I had the same problem with nothing showing for the which psql command till I run the command below to resolve it. The command provided below is just a little tweak of what has already been provided by others here. The only difference is, instead of providing a specific postgres version number in the command, you can simply tell postgres to use the latest postgres version by simply running the following command:
export
PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH"
And now my terminal was able to find the path to postgres when I run which psql.
Hope this helps.
On macOS Mojave these instructions work well:
If your Postgres has not been installed yet, I suggest you use the great "brew" package manager from here https://brew.sh/ :
$ brew cask install postgres
or you can install it usual way from the website
Put this to the bottom of your ~/.bash_profile file:
export PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:${PATH}"
Restart your terminal or restart your ~/.bash_profile directly with the command:
$ . ~/.bash_profile
Verify your installation:
$ psql --version
** Edited: to include a permanent fix, not just during your current session. **
I had this same problem, and also found a clear answer lacking in the docs.
To fix:
Download the new app, and follow the instructions to move it to the Applications folder
Add the new bundle to your path by typing the following in your Terminal (version number specific - mine is 9.4):
PATH="/Applications/Postgres.app/Contents/Versions/9.4/bin:$PATH"
To fix the issue on a permanent basis, run the same line but with export in front:
export PATH="/Applications/Postgres.app/Contents/Versions/9.4/bin:$PATH"
It appears that you installed Heroku's Postgres.app, which is a tool intended for throw-away testing and development. Add the contents of the bundle to your PATH by following the instructions in the Postgres.app documentation - see "command line tools".
On macos mojave i've added the following line on my ~/.profile :
export PATH=$PATH:/Library/PostgreSQL/10/bin
the psql command line client lies into this folder. i've used the enterprisedb installer.
I just experienced the same problem, and solved it by adding export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin to .bash_profile. Note that this line is version-specific, so be sure to check this line against your current version of Postgres.app.
Using Mac OS Monterey, the latest Homebrew (3.4.0) and postgres#13.
I was able to add psql to the path by using -
export PATH="/opt/homebrew/Cellar/postgresql#13/13.6/bin:$PATH"
Replace #13 and 13.6 with your version.
The latest homebrew install location seems to be /opt/homebrew/*
I'm using catalina 10.15.3 and I had the same issue after installing psql using homebrew. Then I noticed, homebrew mentioned
==> libpq
libpq is keg-only, which means it was not symlinked into /usr/local,
because conflicts with postgres formula.
If you need to have libpq first in your PATH run:
echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.bash_profile
So, I ran 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.bash_profile and psql was added to my path
In Mac, there is a SQL Shell application already under /Applications/PostgresSQL
try that
Also, you can run /Library/PostgreSQL/11/scripts/runpsql.sh
In my case, I installed Postgres12 and had the same issue. I had to look out for the location of my bin folder. It happened to be in /Applications/2ndQuadrant/PostgreSQL/12/bin. So I had to run export PATH="/Applications/2ndQuadrant/PostgreSQL/12/bin:$PATH" in my terminal and restart the terminal. That solved it.

Run gedit on OSX Mavericks?

The Version of Gedit on the gnome.org site does not seem to run on OSX Mavericks. Is there any way to fix this?
When I tried it, the problem was the version of libxml2 packaged with gedit.
Use the command "brew install libxml2"
then cp /usr/local/Cellar/libxml2/2.9.1/lib/libxml2.2.dylib /Applications/gedit.app/Contents/Resources/lib/.
In the current version of brew, the directory has changed to 2.9.2 so:
then cp /usr/local/Cellar/libxml2/2.9.2/lib/libxml2.2.dylib /Applications/gedit.app/Contents/Resources/lib/.
Having MacPorts installed and comments from above I was able to simply rm /Applications/gedit.app/Contents/Resources/lib/libxml2.2* and it used the system/macports library instead of the bundled one without error.
Just to Revise:
Having macports installed correctly. (If you just updated from e.g. OSX Lion you need to migrate macports to your new Maverics OSX System, https://trac.macports.org/wiki/Migration)
Downloading gedit-3.2.6-3
sudo port install libxml2
and rm /Applications/gedit.app/Contents/Resources/lib/libxml2.2*
Open gedit and start Coding!
For my 13-inch, Early 2011 Macbook pro it worked just fine.
--
If you want to use gedit from Terminal:
add
alias gedit="open -a gedit"
to
~/.bash_profile
Gedit 2.30.2 works.
But your own plugin won't work on Gedit 2.30.2.
I dont know what your goal is, but i found a easier way with another program. If installing all of this starts to get tiersome (that's what i figured out at least, since xcode needed downloading and tampering), i found sublime text 2 to work very nicely.
I found that the version of "libxml2.2.dylib", distributed with Gedit 3.2.6 is outdated.
Install "Xcode" from the App Store (if you have not already done so), then:
$ cp -p /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libxml2.2.dylib /Applications/gedit.app/Contents/Resources/lib/libxml2.2.dylib
One solution (I'm still interested in others) is the following:
The latest version of Gedit (3.2.6-3)for OSX on the Gnome.org website crashes.
The older Gedit 2.30.2 still runs.
try version 2.26.3 of Gedit – it’s working for me on MOJAVE !
http://ftp.gnome.org/pub/GNOME/binaries/mac/gedit/2.26/
Darek
If I am guessing correctly, your aim is a GUI Text editor for convenience.
open /path/to/file
performs the same action as of double clicking on the file from Finder
Also if you want to use it with a specific application like sublime text
open -a 'Sublime Text' /path/to/file

MongoDB Insecure Startup for Mac OS X

I installed MongoDB via Brew and now I get this error:
“/Library/StartupItems/MongoDB” has not been started because it does not have the proper security settings
I've repaired permissions, reinstalled, and it doesn't go away. Any help?
Recent versions of OS X (since Snow Leopard IIRC) are pickier about the permissions on things like startupitems, and will disable them if it thinks they're inappropriate. This should set the permissions it's looking for:
sudo chown -R root:wheel /Library/StartupItems/MongoDB
sudo chmod -R u=rwX,go=rX /Library/StartupItems/MongoDB
sudo chmod -R -N /Library/StartupItems/MongoDB
If you'd like to remove the Startup item, here is a solution: Apple Support Site

Resources