Tag Archives: osx

Starting Apache on Mavericks

As of Mountain Lion and Mavericks you cant start apache off the share menu in system preferences. If you want to start it manually go the the terminal and type:

sudo apachectl start

But, if you want it to start on every launch you can add it to the launch agent by the following:

sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist

The -w is to make it permanent. And ofcourse if you want to remove it again, just change load to unload.

quick unix tips

tail

When debugging a site, i like to keep a terminal up with the apache error log and access log. This is great and all but having one window for each logfile is kind of a pain. But did you know that you can give it all those files you want and get one output? If you give it more than one file it’ll print an overview with a header displaying the filename.

[code]$ tail -f logs/access.log logs/error.log logs/mysql.queries.log[/code]

-f will keep tail open and update the output uppon new additions

grep

Grep is great when you want to find something specific. But did you know that you can search for a string in multiple files recursive? Say you want to find all files with a giving variable or string just do,

[code]$ grep -lr "string" .[/code]

-l gives you a filename with path
-r is recursive from path giving

Say you want to use a regex pattern you can do so by adding -e

Remember these tools all exists within Linux and Mac OS X!