What the f*** is PATH?

When installing applications. The installation guide always says to add this to the PATH. But what the f*** does that mean?

:~user$ echo $PATH

As a beginner this is confusing. You just want to get the thing running without errors.

Let’s dig in.

From StackOverflow:

It is a list of directories in which to search for executable files.

It is when you try to execute a command from your shell (or from within some other program in certain ways), it will search through each of the directories in this list, in order, looking for an executable file of the name you’re provided, and run the first one it finds.

Basically, it is a configuration needed in order for your programs to run.

It can be set on the .bash_profile file for Linux/Unix or the control panel for Windows.

To know more about PATH and .profiles check out these links:

https://stackoverflow.com/questions/18409707/what-is-path-on-the-mac-unix-system

http://blog.taylormcgann.com/2012/06/13/customize-your-shell-command-prompt/

http://blog.taylormcgann.com/2014/04/11/difference-bin-sbin/

My Mac OS crashed. This is how I fixed it.

Yesterday, I received an update notification for the latest release of MacOS High Sierra. So I clicked the update and restart button.

It was noon and I was not at home but in a coffee shop browsing the web about Travis CI. The internet connection was fairly stable in the coffee shop until I noticed the update progress bar was stuck at 50% for some time. I clicked the cancel button and went home.

I restarted the update at home and it was successful until my computer
restarted. I was prompted that an update failed to install. I clicked continue and my computer booted as normal. I was able to use it.

I check the updates and there was still an update left. I thought this was the one that did not install successfully. So I clicked the update button again. My computer rebooted and I was able to use my it flawlessly.

Until I shut it down…

I opened my computer in the evening and it booted slowly until it crashed. I was prompted with this screen.

Screenshot_20180401-132609

I tried rebooting nth times to no avail.

I was frustrated.

I calmed down and pondered on solutions. I created a hypothesis that it might be a bad install because of the experience I had earlier noontime.

The solutions I had were bringing it to the Apple store and have it fixed or find online some suggestions. I went with the latter.

Normally, during crashes, the solution is to reformat or erase everything and do a clean install. This solves most problems but with the sacrifice of loss of files and more effort to fix.

I didn’t want to do that.

The suggestion I found online was to reinstall the OS. For me, I had High Sierra as my OS.

So I restarted my computer and pressed  CMD +R  while it was booting.

This procedure will bring up the disk utility app.

On the disk utility, I opt to install MacOS again. My computer restarted and installed MacOS.

Screenshot_20180401-132614

I waited 1-2 hours for it to complete. After that, I was able to log in and use my computer. My files were still intact. All of my worries were gone.

Hurray!

Takeaways:

  • Don’t download and install an update when the internet connection is unstable.
  • Don’t rush into solutions. Think as many solutions and try the most practical one.
  • Share the problem and solution.

Command Line hiccup: Could not “cd” to a directory

What happened here? I could not “cd” into the Python Practice directory. Normally this would work.

Screenshot at Mar 19 15-51-19

I found out that white spaces are not recognized. Python Practice has space in between so the computer did not recognize it.

I have to put an escape character “\” for it to work.

The command now looks like this:

cd Python\ Practice/

 

Another trick I discovered is using the tab key on the keyboard. When I type “cd Py” then hit the tab key it auto-finds the matching folder.

Cool! Hiccup is gone. I can move on and run my scripts!