How to make a variable available on all processes (when using Distributed)

Beat me to it! You could also just simply do @everywhere x = $x.

With more detail

using Distributed
addprocs(1)

x = 2
@everywhere try @show x; catch e println("there was an error") end
# x = 2
#      From worker 2:    there was an error

# first interpolate the value of x on the local host into the
# expression given to the @everywhere macro
# then @everywhere tells all processes to evaluate the expression "x = 2"
# in their own memory space
@everywhere x = $x
@everywhere @show x
# x = 2
#      From worker 2:    x = 2
2 Likes