aws-deepracer-community / deepracer-core

A repository binding together everything needed for DeepRacer local.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

env.sh conflicts on OSX

Etaggel opened this issue · comments

Hi,

When running the source rl_coach/env.sh on a mac, the following errors are thrown:

hostname: illegal option -- i
usage: hostname [-fs] [name-of-host]
readlink: illegal option -- f
usage: readlink [-n] [file ...]

Looking around the web, readlink on OSX isn't standard (naturally). But a port of it can be installed by:

brew install coreutils

That then gives a greadlink that works in the same way as on other platforms (i.e. it supports the -f option).

I think the -i on hostname is trying to get the IP address of the local machine? On OSX that can be got with:

ipconfig getifaddr en0

But that's perhaps a little brittle as you need to specify which network interface to check. The following command is a little less brittle, but returns multiple IPs (for each interface):

ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}'

Or perhaps just limit the grep to give a single result:

ifconfig | grep "inet " | grep -m 1 -Fv 127.0.0.1 | awk '{print $2}'

I just tested that with my wifi + LAN on/off and it did detect the switch over correctly (i.e. always giving me an active IP). So maybe that's the solution?

Yep it gets the IP of the host so it can be passed into any S3 clients as the endpoint url so minio can be used as an S3 store.

I documented all my workarounds for Mac Pro. Thanks for sharing!
https://gist.github.com/joezen777/6657bbe2bd4add5d1cdbd44db9761edb

Much appreciated. I will look at baking it into the scripts/improving the setup for OSX. For now I will put that link in the readme

FYI, I found this guide (based on joezen777's original guide) for installing on the Mac from the DeepRacer Slack group.

Fix attempted in PR #78.