💥 Swiss Army Knife for Mac OS X !
guarinogabriel/Mac-CLI was a great source of inspiration.
m-cli differs from other mac command line tools in that:
- Its main purpose is to manage administrative tasks and do it easier
- It doesn't install 3rd party tools because it doesn't have dependencies
- The installation is very easy and doesn't require intervention
- It only uses OS X commands
To install or update m-cli you can run this command:
curl -fsSL https://raw.githubusercontent.com/rgcr/m-cli/master/install.sh | sh
You can also install it in a different path
INSTALL_DIR=$HOME/.m-cli sh <(curl -fsSL https://raw.githubusercontent.com/rgcr/m-cli/master/install.sh)
Note: You should reload your shell in both cases
Swiss Army Knife for Mac OS X !
usage: m [OPTIONS] COMMAND [help]
OPTIONS
--update update m-cli to the latest version
--uninstall uninstall m-cli
COMMANDS:
help
battery
bluetooth
dir
disk
dns
dock
finder
firewall
gatekeeper
hostname
info
lock
ntp
network
nosleep
restart
safeboot
screensaver
service
shutdown
sleep
timezone
trash
user
volume
vpn
wallpaper
wifi
usage: m battery [ status | help ]
Examples:
m battery status # get the battery status
usage: m bluetooth [ status | enable | disable | help ]
Examples:
m bluetooth status # bluetooth status
m bluetooth enable # turn on bluetooth
m bluetooth disable # turn off bluetooth
usage: m disk [ ls | list | info | fs | filesystems | ejectall | verify | repair | help ]
Examples:
m disk ls # list disks
m disk list # list disks
m disk list /dev/disk0 # list a specific disk
m disk fs # list available filesystems for formatting
m disk filesystems # list available filesystems for formatting
m disk info /dev/disk0 # display information
m disk ejectall # eject all mountable volumes
m disk verify volume /Volume/MyVol # verify volume
m disk verify disk /dev/disk0 # verify disk
m disk repair volume /Volume/MyVol # repair volume
m disk repair disk /dev/disk0 # repair disk
m disk format MS-DOS MYNAME /dev/disk2 # format the entire disk with a windows format (MS-DOS)
m disk format volume MS-DOS MYNAME /Volumes/myvol # format the volume with a windows format(MS-DOS)
m disk reformat /Volumes/myvol # reformat a volume
m disk rename CURRENTNAME NEWNAME # rename a volume
usage: m dns [ flush | help ]
Examples:
m dns flush # flushes local DNS
usage: m dock [ showdelay | autohide | magnification | position | addblankspace | addrecentitems | help ]
Examples:
m dock showdelay x.x # Changes how long the Dock takes to show up when auto-hide is enabled
m dock autohide YES # Enable Dock's auto hide feature
m dock autohide NO # Disable Dock's auto hide feature
m dock magnification YES # Turn magnification on
m dock magnification NO # Turn magnification off
m dock position BOTTOM # Change Dock's position to the bottom of the screen
m dock position LEFT # Change Dock's position to the left of the screen
m dock position RIGHT # Change Dock's position to the right of the screen
m dock addblankspace # Add a blank space (separator) to the Dock
m dock addrecentitems # Add a stack containg your recent items to the Dock
# (You can change the stack's type by right clicking on it)
usage: m dir [ tree | delete | help ]
Examples:
m dir tree # tree view of folders in the current path
m dir tree /path # tree view of folders in a specific path
m dir delete empty # delete empty folders recursively in the current path
m dir delete empty /path # delete empty folders recursively in a specific path
usage: m finder [ showhiddenfiles | showfileextensions | help ]
Examples:
m finder showhiddenfiles # get the current status
m finder showhiddenfiles YES # show hidden files
m finder showhiddenfiles NO # no show hidden files
m finder showextensions # get the current status
m finder showextensions YES # show all file extensions
m finder showextensions NO # don't show all file extensions
usage: m firewall [ status | enable | disable | add | help ]
Examples:
m firewall status # Show status
m firewall enable # Enable firewall
m firewall disable # Disable firewall
m firewall add /path/to/file # Add app to firewall
usage: m gatekeeper [ status | list | ls | enable | disable | create | help ]
Examples:
m gatekeeper status # gatekeeper status
m gatekeeper list # list rules
m gatekeeper enable # enable gatekeeper
m gatekeeper disable # disable gatekeeper
m gatekeeper enable MYRULE # enable rule
m gatekeeper disable MYRULE # disable rule
m gatekeeper create RULENAME /path/to/program # Create a rule for the application
usage: m hostname [ help ]
Examples:
m hostname # get the current hostname information (computername, hostname, localhostname and netbiosname)
m hostname newhostname # set a new hostname (computername, hostname, localhostname, netbiosname)
m hostname help # only shows this help
usage: m info [ help ]
Examples:
m info # print Mac OS X operating system version information
usage: m lock [ help ]
Examples:
m lock # lock session
usage: m ntp [ status | enable | disable | set | help ]
Examples:
m ntp status # status of the network time service
m ntp enable # enable clock to use network time
m ntp disable # disable clock to use network time
m ntp set timehost1.net.sap.corp # set network time server
usage: m network [ ls | list | location | help ]
Examples:
m network ls # list network interfaces
m network location # get current location
m network location ls # list locations
m network location create XYZ # create a location
m network location delete XYZ # delete a location
m network location switch XYZ # switch location
usage: m nosleep [ until | help ]
Examples:
m nosleep until 3600 # no sleep until 3600 seconds
m nosleep until my_script.sh # no sleep until the script ends
usage: m restart [ -f | --force | help ]
Examples:
m restart # restart computer (needs confirmation)
m restart -f # restart computer (without confirmation)
usage: m safeboot [ status | enable | disable | help ]
Examples:
m safeboot status # get the boot args
m safeboot enable # enable safe boot
m safeboot disable # disable safeboot
usage: m screensaver [ askforpassword | help ]
Examples:
m screensaver # launch screensaver
m screensaver askforpassword # get the current status
m screensaver askforpassword YES # enable password requirement to unlock
m screensaver askforpassword NO # disable password requirement to unlock
usage: m service [ --status-all | --list | --ls | start | stop | load | unload | help ]
Examples:
m service --status-all # list all services
m service --list # list all services
m service --ls # list all services
m service --ls com.apple.sessionlogoutd # show information about a specific service
m service start com.apple.sessionlogoutd # start a service
m service stop com.apple.sessionlogoutd # stop a service
m service load com.apple.sessionlogoutd # load a service
m service unload com.apple.sessionlogoutd # unload a service
usage: m shutdown [-f | --force | help ]
Examples:
m shutdown # shutdown computer (needs confirmation)
m shutdown -f # shutdown computer (without confirmation)
usage: m sleep [ help ]
Examples:
m sleep # put the mac to sleep
usage: m timezone [ list | ls | set | help ]
Examples:
m timezone # get current timezone
m timezone ls # list available timezones
m timezone set Europe/Berlin # set timezone
usage: m trash [ status | clean | help ]
Examples:
m trash status # get trash info
m trash clean # clean trash
usage: m user [ list | ls | info | create | delete | help ]
Examples:
m user ls # list users
m user info demouser # display user information
m user create # create a user, it will ask you the below information
Username:
Full name:
Shell [/bin/bash]:
Password:
m user delete demouser # delete user
usage: m volume [ level(0-100) | mute | unmute | ismute ]
Examples:
m volume 70 # set the volume to 70 %
m volume # get the volume level
m volume mute # set mute
m volume unmute # unset mute
m volume ismute # check the volume status
usage: m vpn [ ls | list | start | stop | status | help ]
Examples:
m vpn ls # list VPN connections
m vpn start VPN # start vpn connection named VPN
m vpn stop VPN # stop vpn connection named VPN
m vpn status VPN # status vpn connection named VPN
usage: m wallpaper [ /path/to/file.jpg | help ]
Examples:
m wallpaper ./wallpapers/tree.jpg # set wallpaper
usage: m wifi [ scan | off | on | connect | help ]
Examples:
m wifi status # wifi status
m wifi scan # scan wifi
m wifi showpassword ESSID # show wifi network password
m wifi history # wifi connection history
m wifi off # turn off your wifi
m wifi on # turn on your wifi
m wifi connect ESSID PASSWORD # join a wifi network
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request 🤘
- Add more plugins
- Add a brew formula
- Improve the help
- Improve the installation script
MIT License © Rogelio Cedillo