<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nick Q</title>
    <description>The latest articles on DEV Community by Nick Q (@kidqueb).</description>
    <link>https://dev.to/kidqueb</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F177180%2F45a3eea5-a96d-4823-88fa-325990251c12.png</url>
      <title>DEV Community: Nick Q</title>
      <link>https://dev.to/kidqueb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kidqueb"/>
    <language>en</language>
    <item>
      <title>Setting up a Mac for development</title>
      <dc:creator>Nick Q</dc:creator>
      <pubDate>Mon, 13 Apr 2020 21:04:41 +0000</pubDate>
      <link>https://dev.to/kidqueb/zero-to-blog-part-1-setting-up-a-mac-for-development-557k</link>
      <guid>https://dev.to/kidqueb/zero-to-blog-part-1-setting-up-a-mac-for-development-557k</guid>
      <description>&lt;p&gt;I'm no stranger to setting up a new machine for development. My love for shiny new equipment and almost bi-yearly machine wipes have got my process fairly tuned. Part 1 of this series is going to cover the initial steps of setting of a new Mac with a simple dev environment along with all the applications and settings I've come to enjoy.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Homebrew&lt;/li&gt;
&lt;li&gt; Runtime management with asdf&lt;/li&gt;
&lt;li&gt; PHP &amp;amp; Laravel Valet&lt;/li&gt;
&lt;li&gt; System settings and the dock&lt;/li&gt;
&lt;li&gt; Bonus&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Homebrew
&lt;/h2&gt;

&lt;p&gt;The benefits of using &lt;a href="https://brew.sh/"&gt;Homebrew&lt;/a&gt; are two-fold. We often get access to all the packages and libraries we may need on our development journey, but also get a simple interface for installing applications without needing to navigate away from our terminal window. I like to install Homebrew right off the bat so that I can also sit back while brew cask installs the majority of my most critical applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing Homebrew
&lt;/h3&gt;

&lt;p&gt;First thing's first. We need to make sure we have the Command Line Tools installed before we can utilize Homebrew. Luckily, we're just a couple of copy/pastes away.&lt;/p&gt;

&lt;p&gt;Install the Xcode Command Line Tools and Homebrew:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo xcode-select --install
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This will prompt you to agree to some terms and then it'll be off and running. On fairly quick internet it should only take about 5-10 minutes.&lt;/p&gt;

&lt;p&gt;Once Homebrew has been installed we need to make it available by adding it to our &lt;code&gt;$PATH&lt;/code&gt;. As of Catalina, Mac now uses Zsh by default so we'll echo the path into our &lt;code&gt;.zshrc&lt;/code&gt; instead of a &lt;code&gt;.bash_profile&lt;/code&gt;.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ echo 'PATH="/usr/local/bin:$PATH"' &amp;gt;&amp;gt; ~/.zshrc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As with any changes to our &lt;code&gt;.zshrc&lt;/code&gt; we'll need to restart our terminal window to load the latest settings. Once we do that we can run verify that Homebrew has installed successfully with a simple command.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ brew doctor
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Hopefully, everything goes off without a hitch and you're ready to brew.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Apps with Brew Cask
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/Homebrew/homebrew-cask"&gt;Brew Cask&lt;/a&gt; is a major productivity boost when handling the initial setup of our Mac. In addition to the normal brew install command we get another command called brew cask install that will download and install applications for us. This is just a starter list of apps I use and definitely suggest you customize it based on your needs.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ brew cask install 1password discord figma firefox google-chrome imageoptim iterm2 moom sketch slack spotify visual-studio-code
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This list includes some core utilities like 1password, Image Optim, iTerm 2 and Moom as well as various browsers and design/development tools.&lt;/p&gt;

&lt;p&gt;Going forward we can see if an app we want to install is available by using the default search command. If a Cask is available it will show up under a "Casks" section in the output.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ brew search moom
$ ==&amp;gt; Casks
$ moom
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Runtime management with asdf
&lt;/h2&gt;

&lt;p&gt;No matter your preferred language you'll probably need to manage various versions of it as projects age. &lt;a href="https://asdf-vm.com/"&gt;asdf is version management&lt;/a&gt; with community plugins for many (if not all) of the runtimes you'll come across.&lt;/p&gt;
&lt;h3&gt;
  
  
  Installing asdf
&lt;/h3&gt;

&lt;p&gt;Since we already set up Homebrew we can use that to install asdf. Open up Terminal (or iTerm if you've opted to install that in the last step) and install asdf:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install asdf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;asdf recommends adding a couple of lines to your &lt;code&gt;.zshrc&lt;/code&gt; but since we installed it via Homebrew the autocompletion settings will automatically be configured for us. We still need to make asdf available though:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ echo 'export PATH="$HOME/.asdf/bin:$HOME/.asdf/shims:$PATH"' &amp;gt;&amp;gt; ~/.zshrc
$ echo '. $(brew --prefix asdf)/asdf.sh' &amp;gt;&amp;gt; ~/.zshrc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;At this point asdf would be good to go, but I like to add an optional configuration setting. By default asdf uses &lt;code&gt;~/.tool-versions&lt;/code&gt; to automatically switch between versions. Some languages have their own way of managing versions. For example, Node will try to use a version specified in &lt;code&gt;.nvmrc&lt;/code&gt; or &lt;code&gt;.node-version&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To pick those language-specific version files we need to configure asdf to recognize them.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ touch ~/.asdfrc
$ echo 'legacyversionfile = yes' &amp;gt;&amp;gt; ~/.asdfrc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Restart your terminal again and give it a test:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ asdf -v
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  Preemptively Installing Packages
&lt;/h3&gt;

&lt;p&gt;This step is also optional, but since I do a lot of exploring around various languages I always install the &lt;a href="https://asdf-vm.com/#/core-manage-asdf-vm?id=plugin-dependencies"&gt;common packages asdf suggests&lt;/a&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ brew install coreutils automake autoconf openssl libyaml readline libxslt libtool unixodbc unzip curl gpg
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Installing Node
&lt;/h2&gt;

&lt;p&gt;asdf makes the installation of a runtime very simple. The Node installation is actually an example of one of the more complicated runtimes to install that I've encountered, but isn't at all intimidating.&lt;/p&gt;

&lt;p&gt;First, add the asdf Node plugin:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ asdf plugin-add nodejs
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Then we need to add the Node release team's OpenPGP keys. If you didn't install the the other packages you'll need to install &lt;code&gt;gpg&lt;/code&gt;:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ brew install gpg
$ bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;We can now use the nodejs plugin to install a specific version of Node. To list all available versions we can use the &lt;code&gt;asdf list all &amp;lt;plugin&amp;gt;&lt;/code&gt; command.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ asdf list all nodejs
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;I current have a project that I know uses &lt;code&gt;12.13.0&lt;/code&gt; so I'll go ahead and install that.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ asdf install nodejs 12.13.0
$ touch .tool-versions
$ echo 'nodejs 12.13.0' &amp;gt;&amp;gt; ~/.tool-versions
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Perfect. Node is installed and ready for us when we move onto building our site.&lt;/p&gt;

&lt;p&gt;A quick tip: If you are going to install multiple runtimes you can populate your &lt;code&gt;~/.tool-versions&lt;/code&gt; and run &lt;code&gt;asdf install&lt;/code&gt; once. It will grab any runtime version listed in that file and install it.&lt;/p&gt;

&lt;h2&gt;
  
  
  PHP with Laravel Valet
&lt;/h2&gt;

&lt;p&gt;I know, I know.. we went through all the trouble of installing asdf and we aren't even using it to manage PHP. The way &lt;a href="https://laravel.com/docs/7.x/valet"&gt;Valet&lt;/a&gt; handles PHP versions is already very elegant so fix it if it's not broken.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing PHP, Composer &amp;amp; Valet
&lt;/h3&gt;

&lt;p&gt;We'll kick off this step by installing the latest version of PHP with Homebrew. By default Valet will use Homebrew if you decide to use it to install additional versions.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ brew install php composer
$ composer global require laravel/valet
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;These lines installs both PHP and Composer, PHP's package manager. With PHP and composer installed we can install the Valet package globally. In order to make sure we can call the Valet command we'll need to add it to our path.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ echo 'PATH="$HOME/.composer/vendor/bin:$PATH"' &amp;gt;&amp;gt; ~/.zshrc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Just like the other times we've edited &lt;code&gt;~/.zshrc&lt;/code&gt; we can go ahead and fire up a new window so we have the latest config. Once we do that we can run Valet's install command:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ valet install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;After installation we will be setup to use Nginx as our default web server. Dnsmasq is also installed to provide us with nice local urls. The default local tld is &lt;code&gt;.test&lt;/code&gt;, but you can &lt;a href="https://laravel.com/docs/7.x/valet#installation"&gt;customize&lt;/a&gt; this to whatever you'd like.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using Valet
&lt;/h3&gt;

&lt;p&gt;Valet provides a simple interface for linking projects to use the Valet environment. Let's take a quick look at how we can use it.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd ~/projects/project-name
$ valet link
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;After linking the directory our local site is now setup to run at &lt;code&gt;http://project-name.test&lt;/code&gt;. Of course if you changed that tld you will need to adjust the url.&lt;/p&gt;

&lt;p&gt;Valet also comes with the option to "park" itself in a specific directory where it will serve all of the child directories. Checkout the &lt;a href="https://laravel.com/docs/7.x/valet#serving-sites"&gt;documentation for using Valet&lt;/a&gt; for more information.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tune system settings and the dock.
&lt;/h2&gt;

&lt;p&gt;I'm not too hardcore when it comes to modifying system settings. I do have a couple of must have settings in relation to development.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hide/show speed of the dock
&lt;/h3&gt;

&lt;p&gt;I like setting it up so the dock is hidden and appears when you hover near it. The only problem is the delay before the dock starts to appear and the duration in which it takes to transition is way too slow for my taste. These settings make it appear almost instantly with a slight animation.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ defaults write com.apple.dock autohide-time-modifier -float 0.25;
$ defaults write com.apple.dock autohide-delay -float 0;
$ killall Dock
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  Organize the dock with blank spaces
&lt;/h3&gt;

&lt;p&gt;Absolute necessity here. This snippet will add a blank space to your dock that you can use to organize your app icons into sections. Nothing triggers me quite like some messy icons.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; $ killall Dock
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  Key repeat
&lt;/h3&gt;

&lt;p&gt;Confession: I stink at Vim. I've tried. I've failed. I've tried again. I'm all thumbs. To do my best at keeping my hands on the keyboard I use my arrows, but have to crank up the key repeat speeds while dropping the delay before key repeating starts.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ defaults write -g InitialKeyRepeat -int 10
$ defaults write -g KeyRepeat -int 1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;These changes will take affect after a logout.&lt;/p&gt;

&lt;h3&gt;
  
  
  Remove screenshot shadow
&lt;/h3&gt;

&lt;p&gt;Sharing screenshots has long been apart of my day to day communication flow. I use it to share snippets, work in progress dev work and communicate with my team/clients. To save a couple KBs I remove the shadow, plus I think it looks better.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ defaults write com.apple.screencapture disable-shadow -bool true;
$ killall SystemUIServer
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Bonus
&lt;/h2&gt;

&lt;p&gt;Here are some additional "nice to haves" that I setup on all of my machines. These aren't required in any way, but may be a good resource for you.&lt;/p&gt;
&lt;h3&gt;
  
  
  Alias &lt;code&gt;rm&lt;/code&gt; to &lt;code&gt;trash&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;We've all done it. You get a little fast and loose with the &lt;code&gt;rm -rf&lt;/code&gt; and completely wipe out a directory on accident. By installing &lt;code&gt;trash&lt;/code&gt; and aliasing &lt;code&gt;rm&lt;/code&gt; to it we can prevent a complete delete and instead just move our files to the Trash where we can recover them if needed.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ npm i -g trash-cli
$ echo 'alias rm="trash"' &amp;gt;&amp;gt; ~/.zshrc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now you can &lt;code&gt;rm&lt;/code&gt; to your hearts content without worry.&lt;/p&gt;

&lt;h3&gt;
  
  
  Updating Git
&lt;/h3&gt;

&lt;p&gt;Apple ships with it's own version of git. It's not that it's bad or anything, it's just that updating can be tricky and since we're already using Homebrew to manage everything else, why not keep our git up-to-date using it.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ brew install git
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  VS Code Plugins
&lt;/h3&gt;

&lt;p&gt;The VS Code ecosystem runs deep. There is no lack of themes and plugins. Here are a few of my suggested plugins.&lt;/p&gt;
&lt;h4&gt;
  
  
  Dark Theme: Ayu Mirage PowerUp Theme
&lt;/h4&gt;

&lt;p&gt;There are plenty of forks for the &lt;a href="https://marketplace.visualstudio.com/items?itemName=teabyii.ayu"&gt;original Ayu themes&lt;/a&gt; and this mirage variant hits all the right buttons for me. Building on top of the original it adds bold &amp;amp; italic fonts as well as more distinguishable colors and contrast. It's just a joy to work in.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ code --install-extension geisslerh.ayu-mirage-bold-italic
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4&gt;
  
  
  Light Theme: Night Owl Light Bold (More Contrast)
&lt;/h4&gt;

&lt;p&gt;I may be in the minority here but I actually enjoy working in light themes at times. Specifically day time. After only using a dark theme 24/7 for quite some time I've noticed my eyes not straining as much after making this switch. The &lt;a href="https://marketplace.visualstudio.com/items?itemName=sdras.night-owl"&gt;original Night Owl theme&lt;/a&gt; was made by the mighty &lt;a href="https://twitter.com/sarah_edo"&gt;Sarah Drasner&lt;/a&gt;. As with most themes people take it and tweak it to their needs. The "Bold (More Contrast)" portion of this fork is what really got my attention&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ code --install-extension feego.night-owl-light-bold-more-contrast
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4&gt;
  
  
  Relative Path Extension
&lt;/h4&gt;

&lt;p&gt;It's always hard setting up relative paths. This extension makes it easier by automatically inserting the relative path of a file you specify. Using the hotkeys &lt;code&gt;cmd + h&lt;/code&gt; to bring up the prompt, you then search for the file and hit enter to insert the path. It's a real life saver in those deeply nested directories.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ code --install-extension jakob101.relativepath
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4&gt;
  
  
  Settings Sync Extension
&lt;/h4&gt;

&lt;p&gt;I jump between a Mac Mini and a Macbook Pro. To keep my VS Code settings in sync there is a great plugin aptly named "Settings Sync." Connecting this plugin to Github will give you the ability to sync your settings by storing them in a gist and automatically updating it whenever your settings change.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ code --install-extension shan.code-settings-sync
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Let me know how you like to setup your machine on &lt;a href="https://twitter.com/kidqueb"&gt;Twitter&lt;/a&gt;. I'll do my best to help you debug any issues you run into during this process too.&lt;/p&gt;

</description>
      <category>node</category>
      <category>php</category>
      <category>setup</category>
      <category>mac</category>
    </item>
  </channel>
</rss>
