1

I'm a long time Windows developer guy & did lots of lower-level stuff (hesitate to say power user). I'm very proficient on the command line and using PowerShell... but now that I've moved over to OS X I feel lost at times. I'm not talking about learning the stuff on https://www.apple.com/support/macbasics/pctomac/ rather, to start I'd like to get a better understanding of the organization of the file system & working in the terminal.

I see /usr and folders in there but my lack of understanding in what I'm typing when I go to install some developer utilities / tools (think stuff that involves Homebrew) feels like I've missed a lot of steps.

Any suggestions on where to crash course?

3
  • 2
    OSX is the derivative of UNIX. so the first thing I recommend is understand the terminal basics of UNIX
    – Zeus
    Commented Aug 20, 2014 at 18:25
  • 3
    One of my early OSX books was actually a Unix for Dummies book. Note not Linux. OSX is based on BSD Unix so any resources you can find in that direction will help with command line stuff. Commented Aug 20, 2014 at 19:52
  • Ugh, I totally didn't consider a UNIX book... good call. I'll start there. Thanks! Commented Aug 21, 2014 at 14:01

1 Answer 1

1

I know almost nothing about Windows, but I think the equivalent of PowerShell on the Mac is AppleScript, not bash. The equivalent of bash would be MS-DOS Prompt, right? With PowerShell, you’re scripting the Windows GUI and apps, right? That is AppleScript on the Mac. So you might get more practical — and immediate — results from using the AppleScript Editor app rather than the Terminal app. Terminal enables you to script Unix command-line apps and become a Unix power user, but AppleScript Editor enables you to script both Mac GUI apps and Unix command-line apps, and become a Mac OS X power user.

To give you an idea of what I’m talking about, you can Copy/Paste this AppleScript into your AppleScript Editor and tap the Run button at the top of the window. The HTML source of the current Web page that is showing in Safari will appear in a new document in TextEdit.

tell application "Safari"
    activate
    if document 1 exists then
        set theHTMLSource to the source of document 1
        tell application "TextEdit"
            activate
            make new document with properties {text:theHTMLSource}
        end tell
    end if
end tell

This is a very basic example, but most AppleScripts are just expansions of this core idea of multiple Mac apps working together like a player piano. In-between Safari getting the HTML source and TextEdit rendering it, you could use the “do shell script” command to apply a PHP function to the source. After it is showing in TextEdit, you could use the “save” command to save the source as an HTML document to a particular file folder.

A key thing is that right away, you’re automating the apps you use every day. Anything that can be described as “grunt work” can be automated into a single step with AppleScript, so that you save a lot of time and trouble as you work. And right away, you’re not just using Mac apps, you’re also making Mac apps, because any AppleScript can be Saved as a standalone Mac app.

Ultimately, you do end up learning the Unix shell, but only the parts that you find interesting and useful to your work. For example, if you’re writing an AppleScript and you want it to download a file from a URL, you can have the AppleScript run the Unix “curl” command, but after that the AppleScript might open that downloaded file in Photoshop and add borders to it and reduce it to a certain size and export a Web-ready JPEG, and finally your AppleScript could use an FTP app to upload that JPEG to a particular Web server.

The whole Mac is fair game in one way or another with AppleScript.

1
  • Thanks... but that's not exactly the direction I was going for. I'm not so much looking to do scripting in OS X (if I do I'm going to stick to my xPlat node.js)... I mentioned PowerShell to provide some "experience on Windows context". FWIW, PowerShell isn't comparable to AppleScript that much. If I was to come up with an OS X PowerShell equivalent I might say think C-script or Objective-C-script that interpreted (doesn't need compiler) & runs in bash/terminal. PowerShell has full access to MSFT's .NET Framework & is a scripting language. Commented Aug 21, 2014 at 14:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .