You mean that it works if you run it from the Julia REPL as
include("sample.jl")
but not from terminal as?
julia sample.jl
The error messages seem to indicate the usual unix mess with dependencies conflicts. In this case between the HDF and the netCDF libraries. Being true this means that Homebrew screwed when it built GMT and its dependencies. You built the GMT dev version instead of the stable 6.2.0 release (latest). Should be no problem with this but who knows.