mighty_make
mighty_make copied to clipboard
make prepare on a mac
I got the following errors, on a MacBookPro 2017 with High Sierra 10.13.3
$ make prepare
command -v xetex >/dev/null 2>&1 || { echo "Latex is not installed. Please run make prepare-latex for a minimal installation." >&2; exit 1; }
command -v pandoc >/dev/null 2>&1 || { echo "I require pandoc but it's not installed. Aborting." >&2; exit 1; }
command -v pandoc-crossref >/dev/null 2>&1 || { echo "I require pandoc-crossref but it's not installed. Aborting." >&2; exit 1; }
command -v pandoc-citeproc >/dev/null 2>&1 || { echo "I require pandoc-citeproc but it's not installed. Aborting." >&2; exit 1; }
command -v svn >/dev/null 2>&1 || { echo "I require svn but it's not installed. Aborting." >&2; exit 1; }
mkdir "output"
mkdir "source"
mkdir "style"
touch source/00-metadata.md
if [[ "STYPE" == "darwin" ]]; then open source/00-metadata.md; else xdg-open source/00-metadata.md;fi
/bin/sh: xdg-open: command not found
make: *** [prepare] Error 127
So, first up, I definitely have latex installed
$ which xetex
/Library/TeX/texbin/xetex
$ xetex
This is XeTeX, Version 3.14159265-2.6-0.99998 (TeX Live 2017) (preloaded format=xetex)
restricted \write18 enabled.
**
And pandoc; panda-citeproc; pandoc-crossref
$ which pandoc
/usr/local/bin/pandoc
$ pandoc --version
pandoc 2.1.3
Compiled with pandoc-types 1.17.4.2, texmath 0.10.1.1, skylighting 0.7.1
Default user data directory: /Users/smcphee/.pandoc
Copyright (C) 2006-2018 John MacFarlane
Web: http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
$ pandoc-crossref --version
pandoc-crossref v0.3.0.3 built with Pandoc v2.1.3, pandoc-types v1.17.4.2 and GHC 8.2.2
$ pandoc-citeproc --version
pandoc-citeproc 0.14.3
SVN I will grant you I do not have installed, but I haven't needed it for many years.
Finally, xdg-open. I don't know what that is, but on a Mac for as long as I remember (over ten years), if I want to open a file with the default program, it's open filename
Thank you for the information, this is the first time someone have it tested in a Mac (I do not own one). Right now I really want to lose the svn depedency, and I will work on that.
The error you are getting seems to be in the ifelse statement, seems to be a very evident bug. Will investigate and report back.
Note that mighty_make hasnt been updated to latest pandoc, at some point you will start having errors with --latex-engine, that should be --pdf-engine in the makefile.
All the best.
I tried to address these issues, could you please use the testing branch:
wget http://tiny.cc/mighty_test -O Makefile
The output appears unchanged:
$ make prepare
command -v xetex >/dev/null 2>&1 || { echo "Latex is not installed. Please run make prepare-latex for a minimal installation." >&2; exit 1; }
command -v pandoc >/dev/null 2>&1 || { echo "I require pandoc but it's not installed. Aborting." >&2; exit 1; }
command -v pandoc-crossref >/dev/null 2>&1 || { echo "I require pandoc-crossref but it's not installed. Aborting." >&2; exit 1; }
command -v pandoc-citeproc >/dev/null 2>&1 || { echo "I require pandoc-citeproc but it's not installed. Aborting." >&2; exit 1; }
mkdir "output"
mkdir "source"
mkdir "style"
touch source/00-metadata.md
if [[ "STYPE" == "darwin" ]]; then open source/00-metadata.md; else xdg-open source/00-metadata.md;fi
/bin/sh: xdg-open: command not found
make: *** [prepare] Error 127
$
it's still trying to find that xdg-open command.
There is something related to your version, see the line:
if [[ "STYPE" == "darwin" ]]
It should be
if [[ "$OSTYPE" == "darwin" ]]
Could you check if the line is correct in the makefile itself? Thank you
yeah absolutely it looks right in the makefile. I blew everything away and pulled it down again from the might_test file as you suggested above.
line 103:
if [[ "$OSTYPE" == "darwin" ]]; then open source/00-metadata.md; else xdg-open source/00-metadata.md;fi
but it still echoes as above and fails?!
Ok, thank you. Please try:
└─λ echo $OSTYPE
linux-gnu
In bash, and show me the output please.
$ echo $OSTYPE
darwin17
Found this snippet on a GitHub gist - https://gist.github.com/britzl/267a70d2cf144d651285
case "$OSTYPE" in
solaris*) echo "SOLARIS" ;;
darwin*) echo "OSX" ;;
linux*) echo "LINUX" ;;
bsd*) echo "BSD" ;;
*) echo "unknown: $OSTYPE" ;;
esac
this works, i.e. returns "OSX" on my computer.
Now I see. Thank you. I made the changes, please download from the testing channel and try again.
It still thinks it's interrogating a variable called "STYPE" rather than "OSTYPE (at least that's what it echoes):
if [[ "STYPE" == "darwin*" ]]; then open source/00-metadata.md; else xdg-open source/00-metadata.md;fi
/bin/sh: xdg-open: command not found
make: *** [prepare] Error 127
I added a new make target to test:
ostype:
@echo "$OSTYPE"
produces the output
$ make ostype
STYPE
changing that to
ostype:
@echo "$$OSTYPE"
results in the output
$ make ostype
darwin17
But changing it on the line where its used in the prepare target, changes what's echoed, but doesn't alter the behaviour:
if [[ "$OSTYPE" == "darwin*" ]]; then open source/00-metadata.md; else xdg-open source/00-metadata.md;fi
/bin/sh: xdg-open: command not found
make: *** [prepare] Error 127
changing the line to
if [[ "$$OSTYPE" == "darwin17" ]]; then open source/00-metadata.md; else xdg-open source/00-metadata.md; fi
made it work correctly. although the default editor for .md files is Xcode (!).
Using this regular expression also returned success:
if [[ "$$OSTYPE" =~ ^(darwin) ]]; then open source/00-metadata.md; else xdg-open source/00-metadata.md; fi
Thank you so much for your help.
We can tentatively leave darwin17 in the testing channel, however can I ask you to try another option. Please change the line to:
if [[ $OSTYPE == darwin* ]]; then open source/00-metadata.md; else xdg-open source/00-metadata.md; fi
It seems that the "" behaviour is different in MacOS compared to linux. So, let's take it out and try without the quotes. The above line is working in my end, if I change to linux*. Could you test this last one?
Best, lf
this also misbehaves.
if [[ STYPE == darwin* ]]; then open source/00-metadata.md; else xdg-open source/00-metadata.md; fi
it's like it eats the $O every time. but a double $$ works
if [[ $$OSTYPE == darwin* ]]; then open source/00-metadata.md; else xdg-open source/00-metadata.md; fi
results in it working just fine.
Ok, I have completely changed the behaviour, now try
make update-testing-branch
And make prepare
, see if 00_metadata.md is opened.
Best, lf
it just seems to try to runxdg-open
rather than open
$ make prepare
command -v xetex >/dev/null 2>&1 || { echo "Latex is not installed. Please run make prepare-latex for a minimal installation." >&2; exit 1; }
command -v pandoc >/dev/null 2>&1 || { echo "I require pandoc but it's not installed. Aborting." >&2; exit 1; }
command -v pandoc-crossref >/dev/null 2>&1 || { echo "I require pandoc-crossref but it's not installed. Aborting." >&2; exit 1; }
command -v pandoc-citeproc >/dev/null 2>&1 || { echo "I require pandoc-citeproc but it's not installed. Aborting." >&2; exit 1; }
mkdir "output"
mkdir "source"
mkdir "style"
touch source/00-metadata.md
"xdg-open" source/00-metadata.md
/bin/bash: xdg-open: command not found
make: *** [prepare] Error 127
Leaving the regular approaches to more hackish ones, thank you for bearing with me. Could you please update to the testing branch and try again?
Now open
is the standard and xdg-open
only runs in the exception.
Thank you for your time.