How to open emacs gui/ide from mac terminal?

Assuming you have Emacs installed from Homebrew like this:

brew install emacs --with-cocoa

Just type the following command to open Emacs.app from terminal:

open -a Emacs filename.py

If you want all files opened in the same frame, instead of new frames, put this into your .emacs file:

(setq ns-pop-up-frames nil)

The best way to open files in Emacs from the terminal is the emacsclient command, which will open the file in your existing Emacs app (preventing startup time). If you're on OSX and you installed Emacs through Homebrew, the emacsclient binary will already be set up. (In your Emacs config, you have to include (server-start) somewhere.)

If you actually want to spin up a new GUI app instance instead, you can set up your own shell script and put it in your PATH somewhere before the existing emacs binary. It sounds like you're using Homebrew, which sets up the emacs binary as the following shell script:

#!/bin/bash
/usr/local/Cellar/emacs/24.3/Emacs.app/Contents/MacOS/Emacs -nw  "$@"

The -nw is what prevents Emacs from opening in GUI mode. You can make your own emacs shell script and leave out -nw:

#!/bin/bash
/usr/local/Cellar/emacs/24.3/Emacs.app/Contents/MacOS/Emacs "$@"