How to use ~ in a Cmd

my goal is to run a command like

ranger ~/.julia/ --choosefile=$(joinpath(homedir(),".julia"))

however, i get this error when I try to use ~ in the path names

julia> run(`ranger $("~/.julia/")`)
Inaccessible paths: ['~/.julia/']
ERROR: failed process: Process(`ranger '~/.julia/'`, ProcessExited(1)) [1]
 [1] run(::Cmd) at ./process.jl:724
 [2] top-level scope at none:0

how can I correctly get julia to build this Cmd and execute it?

Call expanduser on the path first.