I tried to replace a line in a Makefile with sed -i -e 's|$(bindir)\/embossupdate|:|' Makefile, but I got sed: can't read Makefile: No such file or directory

FROM ubuntu:16.04
# EMBOSS (ftp://emboss.open-bio.org/pub/EMBOSS/)
RUN apt-get install libhpdf-dev libpng12-dev libgd-dev -y
ADD EMBOSS-${EMBOSS_VER}.tar.gz /usr/local/
RUN sed -i -e 's|$(bindir)\/embossupdate|:|' Makefile        
RUN ./configure  --enable-64 --with-thread  --without-x
RUN make
RUN ldconfig
RUN make install

What did I do wrong with the sed command?

  • 4
    It's not about sed, but sounds like you don't have Makefile in EMBOSS-${EMBOSS_VER}.
    – cuonglm
    Aug 11, 2016 at 4:20
  • 1
    I think cuonglm is right. Further, your sed-expression won't do what you except, as you forgot to escape $, which will match the end-of-line in this expression. Aug 11, 2016 at 5:00
  • @AndreasWiese The $ is an ordinary character unless at the end of the expression (or at the end of a group) in a BRE.
    – Kusalananda
    Aug 11, 2016 at 6:08

1 Answer 1


The Makefile is not created until you've run the configure script. Try placing the sed command after the invocation of configure.

I haven't checked if the sed edit is doing what it should or not, but the main issue is probably that the Makefile simply doesn't exist yet at that point in your script.

In general, I would avoid sed -i as its semantics is different for GNU and BSD sed. It's safer to sed ... file >tmpfile && mv tmpfile file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.