7

Hi Im trying to get the LessCss command line compiler installed on a Mac.

I've tried

brew install less
Error: No available formula for less

brew install lessc
Error: No available formula for lessc

sudo npm install -g less
..Installs happily..

sudo npm install -g lessc
npm http GET https://registry.npmjs.org/lessc
npm http 404 https://registry.npmjs.org/lessc
npm ERR! 404 'lessc' is not in the npm registry.

npm install less --global
..Installs happily..

npm install lessc --global
npm http GET https://registry.npmjs.org/lessc
npm http 404 https://registry.npmjs.org/lessc
npm ERR! 404 'lessc' is not in the npm registry.

and all I get is

less js/less/style.less > style-theme.css
-bash: less: command not found

lessc js/less/style.less > style-theme.css
-bash: lessc: command not found

Does anyone have any experience with this?


I found something said my path variable might be messed up. This:

/bin/echo $PATH

gets me:

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin
1
  • How did you install node? Homebrew? Commented Oct 10, 2013 at 20:54

3 Answers 3

17

the npm package name for lessc is less

try writing

sudo npm install -g less
Sign up to request clarification or add additional context in comments.

5 Comments

Ya I did that too, I looked at the NPM page. I think my path variable might be messed up. /bin/echo $PATH gets me/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin
it looks fine, make sure you have lessc in one of those paths, if not search for it and add it's directory to your $PATH
Thats exactly what Im doing. I've checked in /usr/local but I haven't found where Node was installed yet.
the path for lessc shortcut on my ubuntu machine is /usr/local/bin/lessc and the actual path is /usr/local/lib/node_modules/less/bin/lessc
Hmmm When I ls /usr/local/lib/node_modules all I get is npm... I wonder where I'm installing global modules then...
9

I will try to provide a complete answer.

All commands must be executed in the Terminal application.

  1. If you don't have it: Install Command Line Tools for Xcode

    xcode-select --install

  2. If you don't have it: Install HomeBrew

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  3. If you don't have it: Install Node.js

    brew install node

  4. Install LessCSS

    sudo npm install -g less

Now you can execute lessc commands.

2 Comments

Thanks Jeroen! This installs fine, but seems to build the executable with ownernship root and non-executable by group/others. Is this normal? How do I fix? sudo ll /usr/local/bin/lessc lrwx------ 1 root wheel 34 Oct 29 10:11 /usr/local/bin/lessc@ -> ../lib/node_modules/less/bin/lessc
@NicCottrell Here it does not do that. Just re-installed lessc on a fresh MacOS. Both binary and symlijk have lrwxr-xr-x. You can fix it by doing: sudo chmod -h 755 /usr/local/bin/lessc /usr/local/lib/node_modules/less/bin/lessc
2

i`m using macOS Siera and work for me, you can try:

  1. install npm using brew:

    brew install node

  2. check node and npm version using:

    node -v npm -v

3.change user to SU using:

sudo su

  1. install less:

npm install -g less

Good Luck.....

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.