Yak Shaving My Way To Hacktoberfest - Day 1
Tags: hacktoberfest, shell, macos, yakshaving
Published: 2019-10-08 20:09:51

---
title: Yak Shaving My Way To Hacktoberfest - Day 1
published: true
description: On how I tried to get back to coding and all the things I learned along the way
tags: hacktoberfest, shell, macos, yak-shaving
series: Yak Shaving My Way To Hacktoberfest
---

#### _On how I tried to get back to coding and all the things I learned along the way_

Since more than a year now I’ve been promoted to a lead position. In my current company, this implies much more focus on people management and high level conversations around company priorities and goals than coding, or anything too technical for that matter.

In order to not see my hard skills go more rusty than they are already at the moment, and because I’d like to contribute more to open source, I thought doing something for Hacktoberfest.

So, two nights ago I opened my old and faithful personal MacBook Pro 2016, I evaded Netflix suggesting to keep watching the next episode of Star Trek TNG (yes, I’m rewatching all Star Trek in sequential order), went to [up-for-grabs.net](https://up-for-grabs.net) and found an [issue on the Gitlab repo](https://gitlab.com/gitlab-org/gitlab/issues/7792) I believe I can tackle in a reasonable amount of time.

I fired iTerm and cloned the repo, ran `bundle` and here starts the adventure: I had an old version of ruby, 2.4.9 (yes, I haven't updated in that long) and therefore unable to bundle much because Gitlab develop branch is currently running on 2.6.3. Fair enough, let's install 2.6.3. rbenv had no idea what I'm talking about, so I ran diligently `brew update && brew upgrade ruby-build` as suggested by rbenv itself.

This was going to take a while, so I went again to up-for-grab.net and find a [second candidate issue on diaspora](https://github.com/diaspora/diaspora/issues/7442). Diaspora is not so up to date with ruby, but its `.ruby-version` is asking for ruby 2.4 that... well, I kinda have since my rbenv instance has all ruby version from 2.4.0 till 2.4.9. Unable to make it work, because it's kind of impossible to get anything meaningful if you search for `.ruby-version version ruby` on DuckDuckGo, I decided to just change the version to a compatible one on the file itself, and god help me. I ran `bundle` and, magically, the console starts working its way through the Gemfile.

All the while, many, many formulas afterwards, I installed 2.6.3. on the Gitlab repo directory. `bundle` launched in the second terminal window, I waited. And waited. And waited.

```
ERROR: Could not find a valid gem 'rails' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - timed out
```
The status page for RubyGems was telling me everything was cool, so I kept searching. StackOverflow suggested it was a DNS issue. After a `ping` on RubyGems that returns a nice `unknown host: https://rubygems.org`, I realized that, nice, too many people are trying to do something good for open source, and we are collectively DDoSing RubyGems. 

The bundle on the Diaspora repo directory also failed with the same error. I launched bundle in both windows again. It worked. Until it didn't work. The Gitlab bundling complained about a couple of gems, nothing that a quick check on DuckDuckGo and a `brew`command couldn't help with. Same for diaspora. Keep going, keep going.

I hit the very first wall on the Gitlab bundling, where while trying to install [`ruby-prof`](https://github.com/ruby-prof/ruby-prof), I get the error

```
warning: implicit declaration of function 'clock_gettime'
error: 'CLOCK_REALTIME' undeclared (first use in this function)
```

StackOverflow told me it's a problem of standard, the function is not available in [C99](https://en.wikipedia.org/wiki/C99) - and that is the dialect my version of XCode developer tools [currently supports](https://stackoverflow.com/questions/5313684/whats-the-term-ansi-c-specifies-if-it-used-with-gnu89-c89-gnu99-c99) - but [it is available](https://stackoverflow.com/a/13070009) in [POSIX](https://en.wikipedia.org/wiki/POSIX), MacOS is POSIX-compatible, so I should add a declaration to set a specific flag in the code I'm running, before `time.h` is called. O..kay, I guess?

I open the gem, I add the declaration, but of course running `bundle` again overwrites the content of the gem, deleting my changes. Dead end.

In the mean time, Diaspora has stopped bundling for an error on another gem, fix that with another round of `brew install`. The bundle completed. 

I run the specs out of habits, realized I am still missing the database.  After running `rake db:setup`, bundle complained that it couldn't find the postgres gem. 
I found [it's indeed in the Gemfile](https://github.com/diaspora/diaspora/blob/develop/Gemfile#L74), but it's under the `:postgres` group and it's optional. You can [run](https://bundler.io/guides/groups.html#optional-groups) bundle with a `--with :<group_label>` flag.
Running bundle this time installed the [`pg` gem](https://bitbucket.org/ged/ruby-pg/wiki/Home), but when attempting to run `db:setup` again

```
rake aborted!
PG::ConnectionBad: could not connect to server: Connection refused
	Is the server running on host "localhost" (::1) and accepting
	TCP/IP connections on port 5432?
could not connect to server: Connection refused
	Is the server running on host "localhost" (fe80::1) and accepting
	TCP/IP connections on port 5432?
could not connect to server: Connection refused
	Is the server running on host "localhost" (127.0.0.1) and accepting
	TCP/IP connections on port 5432?
/Users/molli/.rbenv/versions/2.4.9/bin/bundle:23:in `load'
/Users/molli/.rbenv/versions/2.4.9/bin/bundle:23:in `<main>'
Tasks: TOP => db:setup => db:schema:load_if_ruby => db:create
```

I ran my `pgstart` shortcut. Command not found. I don't have it here, only on the laptop at work ([for the curious](https://gist.github.com/nirnaeth/9a0a55990cb14d018707f7e1ea55a2bb#file-bashrc-L19)). I have postgres installed with homebrew, so I ran

```
brew services start postgresql
```

as stated in [the PostgreSQL Wiki](https://wiki.postgresql.org/wiki/Homebrew).

The service started, but running `db:setup` gave me the same error. I had a vague recollection of installing PostGreSQL standalone at work, so I removed postgres from the formulas and installed [PostGreSQL standalone](https://www.postgresql.org/download/macosx/). While I was moving the app to the Application folder, I noticed a big forbidden sign on the icon. I hovered. The version is incompatible with my MacOS El Capitan (yes, I know).

I could have installed an older version, but this was getting far more complicated than I wanted and somewhat ridiculous, and I might need to keep yak shaving until the end of October.

The dreaded time had come. I needed to bit the bullet. I took the decision to upgrade the OS. This meant that I needed to do a backup first, because god knows when was the last time. I plug the HD with Time Machine in and launched it. Almost 6GB. It took its sweet time, since my last backup was August 2019. Quite impressive, if you think I only watched Netflix on this laptop since then. It is quite inconvenient to have to plug in the external drive every time I want to back up, so I went and [started looking](https://www.amazon.it/dp/B074DXNT7T/ref=cm_sw_r_cp_api_i_e16MDbXXFP999) for [a NAS](https://www.amazon.it/WDBVBZ0000NCH-EESN-Network-Attached-Storage-Diskless/dp/B01BIGST2U) that I can use with Time Machine. I realize I know nothing of NASes (teh-eh), but having one connected to Internet makes me uneasy regarding my data. I make [some](https://duckduckgo.com/?q=privacy+safe+wifi+nas+mac&t=ffab&atb=v70-1) [more](https://duckduckgo.com/?q=wifi+time+machine+hard+disk+no+network&t=ffab&atb=v70-1) [researches](https://appleinsider.com/articles/18/05/10/nas-roundup-best-network-attached-storage-options-for-mac-iphone-and-ipad-users). The backup being finally over, I could leave this problem for the future.

The App Store presented me with Mac OS Catalina, all new and shiny. I launched the install. 1 hour. Kill me now. I came back straight from work at 7.30PM to do some coding, and here I was at 11PM, still waiting to even write a single line of it.

I kept digging into the NAS thingy, since I didn't had anything better to do. I found that I can indeed take some measures to avoid people looking around my stuff, and that apparently [Synology is very nice](https://www.cloudwards.net/nas-security-guide/).

At 12PM, the Mac told me it was time to install, I hit "Go", but the installer didn't like I had only a couple of GB available. I launched [OmniDiskSweeper](https://www.omnigroup.com/more), waited for it to find that I had 12GB to spare in the MobileSync folder if I would [delete an old iPhone](https://discussions.apple.com/thread/8040253) backup. I killed the backup. The installer happily abode and restarted my laptop for the actual installation. 1AM, time to go to bed.