The Command Line Tools Package is a small self-contained package available for download separately from Xcode and that allows you to do command line development in macOS.
To install it, simply run the following command in a terminal
$ xcode-select --install
The default terminal emulator on MacOS is Terminal. iTerm2 is a feature-rich terminal emulator for MacOS.
Fix OS X painfully missing features
To avoid your mac to go to sleep when you close the lid and you are on battery.