Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

233 Commits

Repository files navigation

Mac CLI

 OS X command line tools for developers

image

The ultimate tool for developers to manage their Mac. It provides a huge set of command line commands that automate the usage of your OS X system. When you run a function, the executed command is displayed and that helps you memorize each of the Utilities for future usage.


Installation in 2 Simple Steps

1- Download command line tool to your local machine:

git clone https://github.com/guarinogabriel/mac-cli.git && cd mac-cli

2- Run the installer. There are 2 install options:

The following command will install the minimum required dependencies:

sh mac install

The following command will install all the dependencies and integrated projects:

sh mac install:all

Re-open your terminal client. You will be able to run all the commands listed below, for example:

mac help


Configuration

Update the shell script to match your local environment configuration. Global variables are defined at the beginning of the file.


Requirements

These are the requirements to be able to run all the commands (all the dependencies/requirements can be installed running "mac install"):

  • Homebrew
  • Git
  • Python
  • Pipe Viewer (pv)

Integrated Projects

The following amazing projects have been integrated on the mac script (all the integrated projects can be installed running mac install:all):


Commands List

CommandDescriptionArguments
mac listList all available commands in mac script
mac list:generalList all general commands in mac script
mac list:searchList all search commands in mac script
mac list:networkList all network commands in mac script
mac list:lampList all LAMP commands in mac script
mac list:sshList all SSH commands in mac script
mac list:performanceList all performance commands in mac script
mac list:terminalList all terminal commands in mac script
mac list:gitList all Git commands in mac script
mac list:webList all Web commands in mac script
mac list:brewList all Homebrew commands in mac script
mac list:xcodeList all Xcode commands in mac script
mac list:imageList all Image commands in mac script
mac list:magentoList all Magento commands in mac script

General Commands

CommandDescriptionArguments
mac installInstall all mac script dependencies to be able to run all commands
mac install:allInstall all mac script dependencies and integrated projects
mac updateInstall OS X software updates, update installed Ruby gems, Homebrew, npm and their installed packages
mac lockLock
mac restartRestart OS X
mac sleepSleep mode
mac shutdownShutdown
mac timeShow clock at top right position in Terminal/iTerm
mac screensaverStart screensaver
mac folders:listList folders in current directory with their current size
mac folder:sizeCalculate current folder size
mac folders:remove-emptyRemove empty subdirectories
mac apps:close-allClose all opened apps
mac apps:app-storeGet list of installed apps from App Store
mac eject-allEject all mounted volumes and disks
mac battery:statusGet battery status
mac infoGet OS X version information
mac find:text XFind exact phrase recursively inside directoryX = Text string
mac find:biggest-filesFind biggest files inside directory
mac find:biggest-directoriesFind biggest directories inside directory
mac zip:extract XExtract Zip file to current folderX = Zip file to extract
mac gzip:compress XCompress current file using GzipX = File to compress
mac gzip:extract XExtract Gzip file to current folderX = Gzip file to extract
mac tar:compress XCompress X file/directory using tar with progress indicatorX = File or directory
mac tar:extract XExtract tar file to current folderX = Tar file to extract

Search Utilities

CommandDescriptionArguments
mac find:recent NFind files modified in the last N minutesN = number of minutes
mac find:duplicatedFind duplicated files
mac search:replace XSearch and replace string in fileX = File to perform the search and replace operation

Network Utilities

CommandDescription
mac speedtestInternet connection speed test
mac speedtest:infiniteRun internet speed test each 5 minutes
mac portsList of used ports
mac ip:localGet local IP address
mac ip:publicGet public IP address

LAMP (Linux, Apache, MySQL, PHP) Utilities

CommandDescriptionArguments
mac mysqlOpen Sequel PRO app)
mac mysql:cliStart MySQL CLI with autocompletion and syntax higlighting
mac phpmyadminOpen PHPMyAdmin
mac mysql:listList all MySQL databases
mac mysql:dump-allExport all MySQL databases to individual files
mac mysql:dump XExport MySQL database to current directoryX = database name
mac mysql:import XImport MySQL databaseX = SQL file
mac mysql:import-table XImport single MySQL database tableX = SQL file containing database table
mac mysql:create XCreate MySQL databaseX = Database name
mac mysql:drop XRemove MySQL databaseX = Database name
mac mysql:duplicate XDuplicate MySQL databaseX = Database name
mac mamp:startStart MAMP Server (Apache and MySQL)
mac mamp:stopStop MAMP Server (Apache and MySQL)
mac mamp:restartRestart MAMP Server (Apache and MySQL)
mac php:syntaxCheck PHP Syntax for all PHP files in current location
mac php:infoGet PHP info on command line
mac hosts:editEdit hosts file

SSH Utilities

CommandDescriptionArguments
mac ssh:download-file XDownload file from remote server through SSHX = Path of the remote file to download
mac ssh:download-folder XDownload entire folder from remote server through SSHX = Path of the remote folder to download
mac ssh:download-database XDownload MySQL from remote server through SSHX = Name of the database to download
mac ssh:sync:local XSync local folder with remote folder using rsync through SSH (download remote folder to local folder)X = Path of the remote folder to sync to local folder
mac ssh:sync:remote XSync remote folder with local folder using rsync through SSH (upload local folder to remote folder)X = Path of the remote folder to sync from local folder
mac ssh:upload XUpload file to remote server through SSHX = Path of the file to upload to the remote server
mac ssh:public-keyCopy SSH Public Key
mac ssh:listList all the saved SSH credentials

LAMP Utilities

CommandDescriptionArguments
mac mysql:guiOpen Sequel PRO app)
mac mysql:cliStart MySQL CLI with autocompletion and syntax higlighting
mac phpmyadminOpen PHPMyAdmin
mac mysql:listList all MySQL databases
mac mysql:dump-allExport all MySQL databases to individual files
mac mysql:dump XExport MySQL database to current directoryX = database name
mac mysql:import XImport MySQL databaseX = SQL file
mac mysql:import-table XImport single MySQL database tableX = SQL file containing database table
mac mysql:create XCreate MySQL databaseX = Database name
mac mysql:drop XRemove MySQL databaseX = Database name
mac mysql:duplicate XDuplicate MySQL databaseX = Database name
mac mamp:startStart MAMP Server (Apache and MySQL)
mac mamp:stopStop MAMP Server (Apache and MySQL)
mac mamp:restartRestart MAMP Server (Apache and MySQL)
mac php:syntaxCheck PHP Syntax for all PHP files in current location
mac php:infoGet PHP info on command line
mac hosts:editEdit hosts file

Web Development Utilities

CommandDescriptionArguments
mac dev:monitor XMonitor file changes (for example: log files)X = File to monitor
mac dev:compass:compileCompile current folder using compass
mac dev:optimize-imagesOptimize all images in current directory and subdirectories
mac dev:css:convert-to-scssConvert CSS file to SCSS

Performance and maintenance Utilities

CommandDescription
mac systemShow system information to review mac performance
mac tempShow temperature, fan and battery statistics
mac memorySee memory usage sorted by memory consumption
mac trash:emptyEmpty trash
mac trash:sizeCalculate trash size
mac desktop:cleanupRemove all files and directories from Desktop directory
mac downloads:cleanupRemove all files and directories from Downloads directory

iTerm / Terminal Utilities

CommandDescription
mac iterm:tab-titleSet title of current iTerm tab

Git Utilities

CommandDescription
mac git:configDisplay local Git configuration
mac git:openOpen current repository on Github
mac git:create:branchCreate branch based on current branch
mac git:branches:dateGet last update date for all branches in current project
mac git:undo-commitUndo latest commit
mac git:logSee latest commits IDs and titles for current branch
mac git:branchSee all branches
mac git:branch:renameRename Git branch
mac git:branch:remove-localRemove local Git branch
mac git:branch:remove-remoteRemove local and remote Git branch
mac git:removeRemove Git from current project
mac git:settingsCheck Git settings
mac git:add-removedAdd removed files to staged files
mac git:sizeGet size for current Git directory
mac github:streakSee current Git contribution streak

Web Utilities

CommandDescriptionArguments
mac web:download-imagesDownload all images from website to current directory

Homebrew Utilities

CommandDescription
mac brew:listGet a list of installed Homebrew packages

Xcode Utilities

CommandDescription
mac xcode:cleanupCleanup Xcode files to free up hard disk space

Image Utilities

CommandDescriptionArguments
mac image:generate:mobile-app-icons X YGenerate mobile app iconsX = Original image file, Y = Output path

Magento Utilities

CommandDescription
mac magento:versionGet Magento version from current project on command line
mac magento:customer:createCreate Magento customer with sample address and sample credit card information
mac magento:fix-permissionsFix Magento permissions for files and directories
mac magento:order:createCreate sample order in Magento
mac magento:shell-script:createCreate script in Magento shell folder to be run from command line
mac magento:gitignore:createCreate gitignore file for Magento project
mac magento:url-rewrites:enableEnable Magento URL rewrites
mac magento:url-rewrites:disableDisable Magento URL rewrites
mac magento2:installInstall Magento 2 in current folder

About

 OS X command line tools for developers – The ultimate tool to manage your Mac. It provides a huge set of command line commands that automatize the usage of your OS X system.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages