Emacs installed with homebrew only works in terminal - emacs

I just installed the latest Emacs with homebrew:
brew install emacs --with-cocoa
It installed successfully, but only runs in the terminal. When I installed it on another machine it starts a separate GUI window. Do I need to specify additional flags?

you can add it to your apps just by running the below command:
brew linkapps emacs
Doc on linkapps
Find installed formulae that provide .app-style OS X apps and symlink
them
into /Applications, allowing for easier access

If you're launching it from within the terminal application, you're more than likely running the emacs that ships with OS-X (v22, IIRC).
To launch the homebrew version, I created an alias in bash:
alias emacs='open -a /Applications/Emacs.app --args $1'
Then typing 'emacs' from the terminal launches the homebrew version.

Try this one https://github.com/railwaycat/emacs-mac-port it is not official but much better looking on OSX.

You want aquamacs.
It Just Works.

Related

Strange vscode issue in WSL

I've been trying to set up the vscode code . shortcut to work in WSL. Following the instructions from the vscode website, I reinstalled vscode in windows, reinstalled the Remote-Wsl extension, made sure it was in my System Path, and tried running code . in the WSL linux distro terminal. I get the message instructing me to install it on the windows side, and asking me if I want to continue. I hit yes, but it doesn't create the code server folder in my home directory. Typing code . again does the same thing.
Does anyone know why this may be?
This is the output text:
To use Visual Studio Code with the Windows Subsystem for Linux, please install Visual Studio Code in Windows and uninstall the Linux version in WSL. You can then use the code command in a WSL terminal just as you would in a normal command prompt.
Do you want to continue anyway? [y/N]
The error message isn't just pointing out that you need to install the Windows version, but it indicates that you have the Linux version installed in WSL and should remove it.
From that, it sounds like at some point you may have installed the Linux version of VSCode in WSL, and that one is taking priority. You'll need to uninstall it in order to run the Windows version of VSCode with the "Remote - WSL" extension.
You don't mention what distribution you are running, but if it is Ubuntu, try:
sudo apt remove code # or
sudo apt remove code-insiders
Also see the uninstall doc from Microsoft.

I installed PostgreSQL on mavericks, but running `which psql` does not do anything. Did it install correctly?

I installed PostgreSQL using the downloadable graphic installer. I'm able to launch pgAdmin which is PostgreSQL's GUI. However, when I run which psql on the terminal, I'm not getting any path (and based on what I read here it should yield a path provided postgres successfully installed).
After looking at this Stackoverflow post, I should have done it via homebrew. Should I uninstall the PostgreSQL that I got via the graphic installer, and re-install using homebrew?
Noob here, and I appreciate your patience.
If you've installed it using Postgres.app, the path to your binary should be under /Applications/Postgres.app/. Try running this at the terminal, you can see on my system it's under /Applications/Postgres.app/Contents/MacOS/bin.
$: find /Applications/Postgres.app/ -name "psql" -print
/Applications/Postgres.app/Contents/MacOS/bin/psql
If you then want to add this to your path variable, you could use this tutorial.

Installed Postgres.app but it won't work

I just installed Postgres.app on my Mac but it won't work properly. I finished the installation and the app icon is on the menu bar and it says it is listening on port 5432, however, that is what happens if I try to run it from the command-line:
~ $ psql
zsh: correct 'psql' to 'sl' [nyae]? n
zsh: command not found: psql
I had previously installed PostgreSQL via Homebrew but removed it before installing Postgres.app. I am running Mac OS X Lion.
I appreciate any help, I really want to have PostgreSQL running on my machine.
The psql binary for Postgres.app is inside the application bundle and you'll have to add the appropriate directory to your PATH. From the fine manual:
Configure your $PATH
Postgres.app includes many command line tools. If you want to use them, you must configure the $PATH variable.
If you are using bash (default shell on OS X), add the following line to ~/.bash_profile:
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
[...]
So adjust your PATH setting in your zsh config files to include the
Contents/Versions/latest/bin
directory inside your Postgres.app bundle.
I'm reading this as of April 2014 and the directory you must include in your path as far as my Postgres app is concerned is slightly different.
I had to include this:
PATH="/Applications/Postgres.app/Contents/Versions/9.3/bin:$PATH"
I can now run psql in my terminal.
On zsh shell you have the modify .zshrc:
PSQL_PATH="/Applications/Postgres.app/Contents/Versions/latest/bin"
PATH="$PATH:$PSQL_PATH"
On prompt:
exec $SHELL
which psql
What you should do is to use /latest instead of version so you dont need to change it again when updating Postgres.
How to: http://postgresapp.com/documentation/cli-tools.html
then run:
. ~/.bash_profile
to reload .bash_profile and update any functions you add.
This might seem stupid, but I'm curious where you installed Postgres.app? As was suggested in mu is too short's answer, the documentation mentions adding /Applications/Postgres.app/Contents/MacOS/bin to your path. However, this requires that you have installed Postgres.app in your /Applications/ folder.
Before trying any of the more complicated solutions you might have found on Stack Overflow, and other resources via Google, you should make sure you've installed Postgres.app to the right place. It may be as simple as moving Postgres.app to /Applications/ since psql will be found in /Applications/Postgres.app before any other places.
Alternatively, you could use whatever path to Postgres.app you would like. So if you want it in your home directory, then you could use export PATH="~/Postgres.app/Contents/MacOS/bin:$PATH".
HTH
I'm a previous Ubuntu user, now in OSX Trying to run the "which sql" and "pg_restore" commands directly from a terminal I opened didn't work. I clicked on the elephant icon and opened a terminal by "Open psql". Once I've quit from the psql console and written the commands in that terminal, they all worked.
On ZSH terminal, before trying the above solutions you have to install Postgres in the first place. While using Hombrew
First, hit,
brew install postgres Then check if it is installed by which psql

Make emacs run in console mode (-nw) by default

How can I make Emacs run in terminal (or console) mode by default, as if I'd used -nw? And once that's done, how do I force it to run in GUI mode (once) if I need to?
On my Debian testing, alias emacs='emacs -nw' followed by emacs opens Emacs in the terminal. And, in the same session, emacs23-x opens Emacs with the GUI.
In case you decide to use emacs in terminal mode always, install emacs-nox (emacs with no X support).
After installationis still ran by $ emacs so you no need to create aliases again!:)
Its there in repos of Debian Squeeze so must be in Ubuntu also.
This answer suggests the method I found works best for me (was having problems with aliases). Essentially, create an executable script
#!/bin/sh
emacs -nw "$#"
and point $EDITOR to it in your shell rc file.
I ran into this problem and didn't want to set an alias (because I also wanted "emacs -nw" to be my default shell EDITOR but it wouldn't work) so I started grepping around and saw this line in configure
If you are sure you want Emacs compiled without X window support, pass
--without-x to configure.
So, if you want to download and build from source, you can just do
curl http://gnu.mirrors.hoobly.com/emacs/emacs-25.3.tar.xz
tar -xvzf emacs-25.3.tar.xz && cd emacs-25.3
./configure --without-x
make && sudo make install
alias emacs='emacs -nw'
Or
unset DISPLAY

Unable to set IPython default login shell

I installed IPython to my Mac by MacPorts. I can run it by $ IPython, by not as a login shell.
I have tried to find IPython's directory, which I could then put to my terminal's settings, unsuccessfully by
locate /*IPython
I did not manage to find it even by whereis.
How can you set IPython the default login shell?
locate is not a live database so I'm not surprised that it can't find IPython assuming you just installed it
How did you install, IPython? There must be documentation with the package about the install location?
If you have installed it using macports then look in your macports directory (usually /opt/)
If it is /opt/ then look in /opt/local/bin for your python installation