Yak Shaving My Way To Hacktoberfest (2 Part Series)
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 and found an issue on the Gitlab repo 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. 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
brewcommand 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, 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 - and that is the dialect my version of XCode developer tools currently supports - but it is available in 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, but it's under the
:postgres group and it's optional. You can run bundle with a
--with :<group_label> flag.
Running bundle this time installed the
pg gem, but when attempting to run
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). I have postgres installed with homebrew, so I ran
brew services start postgresql
as stated in the PostgreSQL Wiki.
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. 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 for a NAS 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 more researches. 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.
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, waited for it to find that I had 12GB to spare in the MobileSync folder if I would delete an old iPhone backup. I killed the backup. The installer happily abode and restarted my laptop for the actual installation. 1AM, time to go to bed.
This website, DEV, is a social media platform designed specifically for developers.