                :print-no-newline print-no-newline
                :source-map-inline source-map-inline})))]
     (env/with-compiler-env (or compiler-env (env/default-compiler-env opts))
-     (binding [ana/*cljs-ns* 'cljs.user
+     (binding [*err* (if bind-err *out* *err*)
+               ana/*cljs-ns* 'cljs.user
                *cljs-verbose* repl-verbose
                ana/*cljs-warnings*
                (assoc ana/*cljs-warnings*

(defn repl*
  [repl-env {:keys [init need-prompt quit-prompt prompt flush read eval print caught reader
                    print-no-newline source-map-inline wrap repl-requires
                    compiler-env]
             :or {need-prompt #(if (readers/indexing-reader? *in*)
                                (== (readers/get-column-number *in*) 1)
                                (identity true))


(def ^:dynamic *cljs-verbose* false)
(def ^:dynamic *repl-opts* nil)

(defmacro err-out [& body]
  `(binding [*out* *err*]
     ~@body))

;; =============================================================================
;; Copied over from clojure.main
