blog.base2.io

We are Base Two, a technology company in Columbus, OH.

January 4, 2018 – Reed Dunkle Setting Up My PC

I’ve had to set up a Windows development environment three times so far, and each time I’ve been confused by some of the options. I’m hoping this will serve as a quick reference guide the next time someone (or my future self) needs to set up a Windows machine.

On Windows I’ve gone through a few approaches trying to get the terminal features I’ve grown to like from working on Linux and macOS. At first I was using ConEmu, but this time I’ve switched to Zeit’s Hyper. It’s running PowerShell, and I’ve set up Posh-Git, which is similar to oh-my-zsh.

Atom - A quick update

Most of the team has moved on to using VS Code, but I’m still using Atom. I’m not certain of each person’s individual reasons for changing, but Atom does lag for me sometimes so I might give VS Code another try.

As an update, here are the packages I use now:

I install them through the editor’s UI (instead of the command line) so that I can give it permission to install dependent packages. Press Ctrl , to open your Settings. In the left menu, click on “Install”. (I usually forget and click on “Packages” first, then I remember that I have to go to “Install”.)

Git

Installing Git for Windows seems to confuse me a little each time. For the record, this time I went with all of the default options except for these two:

Add Git and Unix tools to PATH

The more Unix tools the better, I think?

Checkout as-is; Commit as-is

Assume that someone else is controlling for this. I don’t want my local environment to convert our project files.

Hyper

After you install Hyper, open it once to ensure that it generates its config file.

PowerShell

Open Hyper’s config file ~/.hyper.js in an editor. Search for the key shell: .... By default it’s set to the Cmd shell (or an empty string). First, I changed my shell value to my PowerShell path. Second, I had to remove '--login' from my shellArgs (but the array at least needs to contain an empty string). Here are the two changes I made:

module.exports = {
  config: {
    // Edit these two:
    shell: 'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe',
    shellArgs: [''],
  },
};

Note that the path to your powershell.exe could be different.

Set default directory

If you want new tabs (CtrlShiftt) to point to your current working directory, you can use the Hyper plugin hypercwd. In your .hyper.js file, under the config: { ... } settings, there’s a plugins array. Add 'hypercwd'.

module.exports = {
  config: { ... },
  plugins: ['hypercwd'],
};

(If you’re curious, I also installed and set up the plugin hyper-sync-settings.)

You’ll have to restart Hyper for the plugin to work.

If you only want to change the default directory, you can do it through PowerShell. In your terminal navigate to your Documents folder (by default mine was C:\Users\reed\Documents). Find or create the WindowsPowerShell directory and move into it. Run this to create a profile config: touch profile.ps1 and open it in an editor. Add this line, but change the path to your desired default directory:

Set-Location C:\Users\...

Save the file and restart Hyper.

Note that this PowerShell setting seems to load after hypercwd, so they don’t both work. The first solution is good enough for my purposes, though.

Posh-Git

Follow the instructions in the README above. As a guideline, this is what I did:

  1. Verify that I have all of the prerequisites. Note that I had to open Hyper as Administrator for some of these.
  2. Install posh-git via PowerShellGet
  3. Configure my PowerShell session to use the posh-git module

Their README lists three steps to complete the above last step. Here’s what I did: - Step 1: I ran the command they have listed. - Step 2: I ran the Add-PoshGitToProfile to have PowerShell load posh-git with every session, but I didn’t do the “AllHosts” thing yet. I’ll update this if that changes. - Step 3: I skipped this.

Connect to GitHub using SSH through Posh-Git

First, I followed GitHub’s steps to Generate a new SSH key for this computer.

Next, moving on to add my new key to the ssh-agent, I skipped their first step, and instead ran the Posh-Git command: Start-SshAgent. Then I moved on to their second step and ran: ssh-add ~/.ssh/id_rsa

Finally, I added the new key to my GitHub account.

Final thoughts

I think part of the reason that I’ve found the Windows setup more confusing is because I’m prompted to make more decisions. Hopefully this reference guide works as a sort of user script to help streamline the installation process. I’ll keep this up-to-date, so please ping me in the comments (@rdunkle) if you catch anything that I should change.

Thanks for reading!

blog comments powered by Disqus