Following on my from Useful Linux Terminal Commands here is my Useful OSX Terminal Commands. This guide is handy for setting up a development OSX installation (e.g Apache, PHP, MySQL etc). I will update this post when I find new commands.
First, read my Useful Linux Terminal Commands post.
Normally I set up Ubuntu servers in the cloud on Vultr (read my guide here) or Ubuntu Servers on Digital Ocean (read my guide here) but this is how I can quickly set up a development environment locally on OSX.
Useful OSX Commands
Prevent your Mac from falling asleep
Prevent your Mac from falling asleep (for 1 minute)
Check Path
$PATH /Library/Frameworks/Python.framework/Versions/3.4/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
Compare files
Show hidden files in Finder
Find file on OSX
Find all listening ports
Find process listening on port 80
Find a Process
Find A File (e.g httpd.conf)
Note: OSX Apache Index file location is…
To edit the default HTML file
Built-In Apache
Disable built-in OSX apache daemon
Restart built-in Apache daemon
View other startup daemons
View All Startup Daemons
Force network drives to automatically connect after each login (instead of manually connecting)
More: https://www.tekrevue.com/tip/automatically-connect-network-drive/
Set PHP as default Web Server delivered file in local Apache
Set…
Install PHP 7.0 on to OSX
FYI: 7.1 and 7.2 are out but I find 7.0 is more stable with WordPress (read more here).
More: https://php-osx.liip.ch/
Create a diag file in your OSX Default Apache root
Edit your default index file
Contents
Now load the file
Install MySQL on OSX
Download: https://dev.mysql.com/downloads/mysql/
Help: https://dev.mysql.com/doc/refman/5.7/en/osx-installation-pkg.html
Uninstall MySQL OSX
Read: https://community.jaspersoft.com/wiki/uninstall-mysql-mac-os-x
Add MySQL to PATH
Reboot and Check the MySQL Service
Check MySQL Version
Login to MySQL from the Command Line
Set a new root password (after logging in as root)
fyi: You can obtain a good password here.
Bonus: Install MySQL (PHP) management tool (in Apache)
Download: https://www.adminer.org/#download Save the file to /Library/WebServer/Documents/adminer.php
Load Adminer in your browser and log in with your root password
Login to Adminer (via Apache/PHP)
Creating MySQL Tables in Adminer (via Apache/PHP)
Adminer allows you to fully manage your MySQL (create databases, users, run queries, alter objects etc)
Adding Records to MySQL with Adminer
Remove MySQL:
Read more here: https://community.jaspersoft.com/wiki/uninstall-mysql-mac-os-x
Get your Mac Processor Name
Show All OSX System Settings
Command:
Show Live File System Usage
Show last 10 lines of the system log
Get Your Local WAN IP Address
Get your Public IPV4 Address
More to come.
Hope this helps someone.
Donate and make this blog better
Ask a question or recommend an article
[contact-form-7 id=”30″ title=”Ask a Question”]
Revision History
v1.2 Find file (current version)
v1.1 Removed system info chunk (too big to format)