Installing AWS CLI on MacOS 10.13

The AWS instructions to install the AWS CLI using Python and pip work on MacOS 10.13 (High Sierra) up to the point of adding the Python install location to your path – I found that on 10.13, following the steps didn’t result in the aws command being found.

At the step to addto your path:

  • running ‘which python’ showed:
$ which python
/usr/bin/python

but, ls -la did not show that this was a symbolic link in my install per the docs, so this location is also not the same location where the pip installed aws command is.

This post has an answer that suggests the issue is because AWS CLI instructions tell you to do:

pip3 install awscli --upgrade --user

but the –user option specifies a user location. To find where the pip install is installing to, do:

python3 -m site --user-base

This told me:

/Users/kev/Library/Python/3.6

So taking a looking in the bin dir in this location, this is where the aws cli ended up. Adding this path to my PATH in my ~/.bash_profile and now aws command works as expected.

Enabling Ubuntu Bash shell on Windows 10 with the Anniversary update

I already have the Anniversary Update on my Windows 10 install, and I needed to ssh into one of my Raspberry Pis. I normally do this from my Mac, but since I’m in Windows 10 working on something, I thought this would be a great opportunity to install the new Ubuntu Bash support and then I can ssh from there right? (I could just install Putty, but then I wouldn’t have a reason to check out the Ubuntu Bash support, right?)

First attempt following instructions here, the bash windows opened and closed quick, too quick to read whether there was an error or not.

Second attempt, from a Command Prompt, entering bash, I got this:

Ok, to enable Developer Mode, into Settings, and click the radio button under ‘Use Developer Features’:

Then I got this error:

Hmm. Not very helpful. Clicking on Learn More opened a browser to a help page, but it didn’t load – I’d reconfigured my ip address to a static address on a local network for testing, and I didn’t have internet access. 0x80004005 probably could be a little more helpful, but enabling DHCP to get an internet connection and then tried selecting the Developer Mode option again, it downloaded, said ‘Some features may not be available until your PC is rebooted’. Rebooted, ran bash from Command Prompt, and now it prompted to download the Ubuntu Bash support. Why it couldn’t have done this already is beyond me, and I’ve already rebooted once, but answering ‘y’ it starts downloading:

After it completes you create a unix user and then you’re all set, and it even has ssh included.

Prepending text to a file with sed

Appending content to a file on Linux is pretty easy with >> but there’s no equivalent redirection to prepend content. Luckily, for every file manipulation problem on Linux there’s at least a dozen solutions.

Using sed with -i for inplace replacement of content in a file, you can match ^ for start of line, and then follow with the content you want to replace (in this case, insert).