New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cd! is not found in script #500

jeffdyke opened this Issue Nov 7, 2016 · 5 comments


None yet
3 participants

jeffdyke commented Nov 7, 2016

Hello, i have completely blown away my ammonite installation of 0.7.0 and am upgrading to 0.7.8, i have cleared the entire ~/.ammonite directory as well as removing the amm binary, in the shell with the downloaded cd! works correctly, in this simple script it gives the following error.


import ammonite.ops._
import ammonite.ops.ImplicitWd._

cd! root/'Users/'jeff
Compiling not found: value cd
val res_2 = cd! root/'Users/'jeff
Compilation Failed
Welcome to the Ammonite Repl 0.7.8
(Scala 2.11.8 Java 1.8.0_101)

I know this will be simple and it seems odd that it compiles in other scripts, before and after the clearing of the cache, so that is when i reduced my issue to this simple set of commands and in this case i likely do not need ImplicitWd._



This comment has been minimized.

jeffdyke commented Nov 8, 2016

not surprising, but this works, but fails later when you try to use % or %% b/c of ambiguous Implicits


#!/usr/bin/env amm
interp.load.ivy("com.lihaoyi" %% "ammonite-shell" % ammonite.Constants.version)
val shellSession =
import shellSession._
import ammonite.ops._
import ammonite.ops.ImplicitWd._
cd! root/'src/'code
println(wd) // "/src/code"

I just want to know if i can use cd! in scripts and if i can't, why and how do i work around this, cd'ing into directories is critical for scripts especially a build script, which is what i'm using Ammonite for mostly.


lihaoyi added a commit that referenced this issue Nov 9, 2016


This comment has been minimized.

jeffdyke commented Nov 9, 2016

Thanks for the fix on the ambiguous imports. Do you have any comments on the original issue? This was simply a hack to try to get around the issue temporarily. This is reproducible on a completely new machine after installing 0.7.9 Thanks!


This comment has been minimized.

jeffbondlink commented Nov 28, 2016

Sorry should have written about this a while ago, the fix for this, at least one without a code change is to create a that can look identical to minus the instantiation of the repl(last line as of 0.8.0). This has been working nicely on 0.8.0. For people interested in where this information is, you can dig into the Internals Documentation, specifically: (predef)[]

Thanks @lihaoyi and contributors for a very helpful product. Please feel free to close this as i don't believe i can.


This comment has been minimized.


lihaoyi commented Apr 30, 2017

cd isn't a member of ammonite.ops; if you want to perform operations in a different directory, define a val newPath = ... and use that in your operations. cd is only available as part of the ammonite shell, as described in

@lihaoyi lihaoyi closed this Apr 30, 2017


This comment has been minimized.

jeffdyke commented May 1, 2017

Thanks but the real issue, and it was solved in other ways in the change in behaviour between 0.7.6 and 0.8.0, from memory, responding only so if people try to upgrade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment