{"id":4552,"date":"2022-11-20T10:25:21","date_gmt":"2022-11-20T16:25:21","guid":{"rendered":"https:\/\/dev.iachieved.it\/iachievedit\/?p=4552"},"modified":"2022-11-20T15:44:47","modified_gmt":"2022-11-20T21:44:47","slug":"developing-on-a-mac-part-i","status":"publish","type":"post","link":"https:\/\/dev.iachieved.it\/iachievedit\/developing-on-a-mac-part-i\/","title":{"rendered":"Developing on a Mac &#8211; Part I"},"content":{"rendered":"<p>This is part one in a series of posts for developing on a Mac.  Note the distinction between developing <I>on<\/I> and <I>for<\/I> a Mac.  We&#8217;re going to be covering the former and not so much the latter.<\/p>\n<p>So you&#8217;ve got a fresh Mac, or have never used your Mac for software development.  Let&#8217;s get some key tools installed.<\/p>\n<h2>iTerm2<\/h2>\n<p>If you&#8217;re a developer the command line is your friend, and you interact with the command line in a terminal.  <a href=\"https:\/\/iterm2.com\">iTerm2<\/a> is a replacement for the macOS <code>Terminal<\/code> application, and is, in my opinion, the best terminal application out there (and trust me, I&#8217;ve tried them all).  Once you download iTerm and run it for the first time you&#8217;ll see:<\/p>\n<p><a href=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2022\/11\/developerToolInstall.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2022\/11\/developerToolInstall.png\" alt=\"\" width=\"463\" height=\"193\" class=\"aligncenter size-full wp-image-4557\" srcset=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2022\/11\/developerToolInstall.png 463w, https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2022\/11\/developerToolInstall-300x125.png 300w\" sizes=\"(max-width: 463px) 100vw, 463px\" \/><\/a><\/p>\n<p>Click <strong>Install<\/strong>!  The <em>Developer Tools<\/em> are a key component to doing any software development on a Mac, so you might as well install it now.<\/p>\n<h2>Oh My Zsh<\/h2>\n<p>Okay, this one isn&#8217;t strictly required, but just adds some sexy to your development environment.  Skip this step if you want (to be boring), otherwise head on over to <a href=\"https:\/\/ohmyz.sh\/\">Oh My Zsh<\/a> and up your shell game.<\/p>\n<p>For a quick install, paste the following into your terminal.<\/p>\n<p><code>sh -c \"$(curl -fsSL https:\/\/raw.github.com\/ohmyzsh\/ohmyzsh\/master\/tools\/install.sh)\"<\/code><\/p>\n<h2>Command Line Developer Tools<\/h2>\n<p>If you installed iTerm2 and clicked <strong>Install<\/strong> when prompted to install the command line developer tools, you&#8217;ll already have this.  If you didn&#8217;t, they can be installed easily with <code>xcode-select --install<\/code>.  To be clear, the developer tools are <strong>required<\/strong> for development on a Mac, and many tools will prompt you if they&#8217;re needed (like iTerm2 did!)<\/p>\n<p>A side note:  it always amuses me when a simple question such as <em>How do I install<\/em> results in Stackoverflow posts such as <a href=\"https:\/\/stackoverflow.com\/questions\/9329243\/how-to-install-xcode-command-line-tools\">this one<\/a>.  For whatever reason the method of installing the command line developer tools is a moving target.<\/p>\n<h2>Homebrew<\/h2>\n<p>Homebrew is, by far, the best package manager for the Mac, and countless instructions are going to have you <code>brew install something<\/code>.  Head on over to <a href=\"https:\/\/brew.sh\">Homebrew<\/a> and use the installation instructions (you will need <code>sudo<\/code> for this).<\/p>\n<p>For a quick install, paste the following into your terminal:<\/p>\n<p><code>\/bin\/bash -c \"$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/HEAD\/install.sh)\"<\/code><\/p>\n<p>Don&#8217;t ignore the output from Homebrew&#8217;s install!<\/p>\n<p>[code lang=text]<br \/>\n==&gt; Next steps:<br \/>\n&#8211; Run these three commands in your terminal to add Homebrew to your PATH:<br \/>\n    echo &#039;# Set PATH, MANPATH, etc., for Homebrew.&#039; &gt;&gt; \/Users\/joe\/.zprofile<br \/>\n    echo &#039;eval &quot;$(\/opt\/homebrew\/bin\/brew shellenv)&quot;&#039; &gt;&gt; \/Users\/joe\/.zprofile<br \/>\n    eval &quot;$(\/opt\/homebrew\/bin\/brew shellenv)&quot;<br \/>\n[\/code]<\/p>\n<p>Failing to do this will result in <code>zsh: command not found: brew<\/code><\/p>\n<h2>What&#8217;s Installed Now?<\/h2>\n<p>After this basic setup you have:<\/p>\n<ul>\n<li>iTerm\n<li>oh-my-zsh\n<li>Homebrew\n<\/ul>\n<p>In addition, there are a <I>lot<\/I> of tools used in software development already there:<\/p>\n<ul>\n<li><a href=\"https:\/\/curl.se\/\">curl<\/a>\n<li>python3 (<a href=\"https:\/\/www.python.org\/downloads\/\">Python<\/a> 3.9)\n<li>ruby (<a href=\"https:\/\/www.ruby-lang.org\/en\/\">Ruby<\/a> 2.6)\n<li>perl (<a href=\"https:\/\/www.perl.org\/\">Perl<\/a> 5)\n<li>tclsh (<a href=\"https:\/\/www.tcl.tk\/about\/language.html\">TCL<\/a>)\n<li><a href=\"https:\/\/git-scm.com\">git<\/a> (revision control system)\n<li><a href=\"https:\/\/clang.llvm.org\">clang<\/a> (a C, C++, and Objective-C compiler)\n<li>gcc (on a Mac, it is `clang` in disguise)\n<li>swiftc (the <a href=\"https:\/\/docs.swift.org\/swift-book\/\">Swift<\/a> compiler) and swift (the Swift interpreter)\n<\/ul>\n<p>What isn&#8217;t installed by default:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.rust-lang.org\/tools\/install\">Rust<\/a>\n<li><a href=\"https:\/\/go.dev\/doc\/install\">Go<\/a>\n<li>Java\n<li><a href=\"https:\/\/nodejs.org\/en\/about\/\">NodeJS<\/a>\n<\/ul>\n<p>We&#8217;ll talk more about this in a moment!<\/p>\n<h2>Installing an Editor<\/h2>\n<p>There are a number of editors and integrated development environments (IDEs) to choose from.  If you are a programmer and already fall into one of the main camps (<code>vi<\/code> and <code>emacs<\/code>) many of them will allow you to set your key bindings to one flavor or another.<\/p>\n<p>Here are some of my favorites:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.sublimetext.com\">Sublime Text<\/a>\n<li><a href=\"https:\/\/code.visualstudio.com\">Visual Studio Code<\/a>\n<li><a href=\"https:\/\/aquamacs.org\/\">Aquamacs<\/a>\n<\/ul>\n<p>And of course, if you&#8217;re going to do development <em>for<\/em> the Mac or other Apple devices (iPhone, Watch, etc.) <a href=\"https:\/\/developer.apple.com\/xcode\/\">Xcode<\/a> is more or the less the required IDE.<\/p>\n<h2>The Environment Trap<\/h2>\n<p>One of the never-ending challenges (and frustrations) of software development is managing all of the different versions of toolchains, compilers, interpreters, libraries, packages, and configurations.  Invariably you&#8217;ll run into <a href=\"https:\/\/en.wikipedia.org\/wiki\/Dependency_hell\">dependency hell<\/a> sooner or later and find yourself in a situation where you&#8217;re tempted to erase your Mac and start over.  When developing on a Mac be mindful of using <code>sudo<\/code> (you&#8217;re likely installing something system-wide that can conflict with other packages), and try to utilize software such as <a href=\"https:\/\/en.wikipedia.org\/wiki\/Dependency_hell\">RVM<\/a> or <a href=\"https:\/\/virtualenv.pypa.io\/en\/latest\/\">virtualenv<\/a>.  <em>Unfortunately<\/em>, there are a plethora of these dependency\/environment managers as well making it even more confusing!<\/p>\n<h2>Where to From Here<\/h2>\n<p>My goal with this first post was to serve as a launching point for tutorials on installing tools for developing in <em>other<\/em> languages and ecosystems.  For example, you&#8217;ll notice we didn&#8217;t cover <a href=\"https:\/\/rubyonrails.org\">Rails<\/a>, <a href=\"https:\/\/nodejs.org\/en\/about\/\">NodeJS<\/a>, <a href=\"https:\/\/www.rust-lang.org\/tools\/install\">Rust<\/a>, etc.  All of these and more are supported quite nicely on macOS with the right software installed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is part one in a series of posts for developing on a Mac. Note the distinction between developing on and for a Mac. We&#8217;re going to be covering the former and not so much the latter. So you&#8217;ve got a fresh Mac, or have never used your Mac for software development. Let&#8217;s get some [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3747,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,116],"tags":[],"class_list":["post-4552","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apple","category-software-development"],"_links":{"self":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/4552"}],"collection":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/comments?post=4552"}],"version-history":[{"count":16,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/4552\/revisions"}],"predecessor-version":[{"id":4586,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/4552\/revisions\/4586"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/media\/3747"}],"wp:attachment":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/media?parent=4552"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/categories?post=4552"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/tags?post=4552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}