claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Installation mechanism besides npm?

Open alex opened this issue 9 months ago • 12 comments

For those of us who aren't JS users, and thus don't already have npm on our systems, it'd be great to have an alternative installation mechanism.

For me personally, providing a brew tap (or even better, an upstream brew formula) would be wunderbar!

Thanks

alex avatar Feb 25 '25 15:02 alex

Great idea! this would be really nice since I don't think npm tools are the best-equipped to self-update, as evidenced by the admonition I'm getting every startup :D

djsavvy avatar Mar 07 '25 14:03 djsavvy

as per my comment in #454 i used this for the homebrew formula

require "language/node"

class ClaudeCode < Formula
  desc "Command line interface for Claude AI by Anthropic"
  homepage "https://www.anthropic.com"
  url "https://registry.npmjs.org/@anthropic-ai/claude-code/-/claude-code-0.2.37.tgz"
  sha256 "ddf92e983a7bad6875d6436deabc32bfbbdfa75b43655c10777ae9d2a9d9a9da"
  license "MIT"

  livecheck do
    url "https://registry.npmjs.org/@anthropic-ai/claude-code/latest"
    regex(/["']version["']:\s*["']([^"']+)["']/i)
  end

  depends_on "node"

  def install
    # Install the package globally within the Homebrew prefix
    system "npm", "install", "-g", "--prefix", prefix, "@anthropic-ai/claude-code@#{version}"
  end

  test do
    system bin/"claude-code", "--help"
  end
end

and run as brew install --build-from-source ./claude-code.rb

marafa-sugarcrm avatar Apr 08 '25 13:04 marafa-sugarcrm

Have you considered submitting that to homebrew itself? (I haven't checked if it complies with the rules)

alex avatar Apr 08 '25 13:04 alex

Any updates on this? I found claude on Homebrew: https://formulae.brew.sh/cask/claude but suspect if its claude-code.

brew install --cask claude-code

This would be great to have.

Dentrax avatar May 24 '25 11:05 Dentrax

Working on it here https://github.com/Homebrew/homebrew-core/pull/224619

Moulick avatar May 24 '25 18:05 Moulick

Not possible in homebrew core unfortunately, It need to be under any of the ~opensource licenses.

Moulick avatar May 26 '25 07:05 Moulick

You could maintain your own tap so folks would just need to do brew install anthropics/claude-code/claude-code or similar

RichardoC avatar May 26 '25 22:05 RichardoC

I'll be happy to write the brew file but someone from Anthropic (@bcherny ?) needs to make the repo, it should be anthropics/homebrew-claude-code or maybe even anthropics/homebrew-claude to cover all in one

Moulick avatar May 27 '25 15:05 Moulick

We are in the middle of updating our distribution to a single file binary. Please hang tight and then we can come back for the brew cask. I'll be the POC for Claude Code on this one.

wolffiex avatar May 27 '25 15:05 wolffiex

Hey @wolffiex , any chance this is available? Would love to use Claude Code without needing to globally install NPM!

mieubrisse avatar Jun 11 '25 18:06 mieubrisse

@wolffiex any news? Would be great to get this out there 💪🏻

Jarvvski avatar Jun 18 '25 16:06 Jarvvski

Working on it! This just requires extreme care because makes will strand our users. I'll update this thread first when it is available.

On Wed, Jun 18, 2025 at 9:02 AM Jarvis @.***> wrote:

Jarvvski left a comment (anthropics/claude-code#80) https://github.com/anthropics/claude-code/issues/80#issuecomment-2984844482

@wolffiex https://github.com/wolffiex any news? Would be great to get this out there 💪🏻

— Reply to this email directly, view it on GitHub https://github.com/anthropics/claude-code/issues/80#issuecomment-2984844482, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABUJ7FBJECQQ5BEY6NDRLD3EGER3AVCNFSM6AAAAABX27EY4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSOBUHA2DINBYGI . You are receiving this because you were mentioned.Message ID: @.***>

wolffiex avatar Jun 18 '25 16:06 wolffiex

We are in the middle of updating our distribution to a single file binary. Please hang tight and then we can come back for the brew cask. I'll be the POC for Claude Code on this one.

Any updates on this?

tdensmore avatar Jul 07 '25 14:07 tdensmore

Oh yes, we are starting testing of our new native install! If you are brave and you're willing to solve potential problems with alpha software, try this:

curl -fsSL claude.ai/install.sh | bash

let us know how it goes!

wolffiex avatar Jul 07 '25 14:07 wolffiex

Oh yes, we are starting testing of our new native install! If you are brave and you're willing to solve potential problems with alpha software, try this:

curl -fsSL claude.ai/install.sh | bash

let us know how it goes!

@wolffiex Thanks!

Installed, but I can't update Claude to the latest version:

Image

xshapira avatar Jul 07 '25 14:07 xshapira

you will have to figure out why you're picking up the wrong claude could be an alias hanging around, or failed uninstall of the global npm version the native install is a symlink at ~/.local/bin/claude please let us know how you resolve and we'll continue to work on our auto-detection

wolffiex avatar Jul 07 '25 15:07 wolffiex

Does the closure mean the brew file is done? Or do you just refer to the binary installation from your website

Jarvvski avatar Jul 11 '25 18:07 Jarvvski

brew tap is not done but we will work on it for now, use curl -fsSL claude.ai/install.sh | bash

wolffiex avatar Jul 11 '25 18:07 wolffiex

Are there any plans to support brew?

azat-io avatar Jul 13 '25 12:07 azat-io

I've opened a PR for adding a cask that just refers to the installer you're providing @wolffiex

https://github.com/Homebrew/homebrew-cask/pull/219840

IMO, would be better to move the checksum verification and arch detection inside of the ruby formulae, but I didn't want to mess with your current deployments where you're checking all of that inside the install.sh

Checking the installer, we could handle all of the installation in the ruby script. But again, not sure what your other plans are

Am i missing other files for the uninstallation other than the binary over in .local/bin/claude and .claude/? The script doesn't provide any uninstall method, so I had to make some assumptions

Jarvvski avatar Jul 13 '25 14:07 Jarvvski

@Jarvvski You may want to deconstruct the install.sh and move the logic inside the .rb. Depending on what's available upstream you may be able to do some version/arch parsing logic there.

timfallmk avatar Jul 14 '25 21:07 timfallmk

Wow, this is awesome @Jarvvski thank you. I was worried we were going to have to push my ruby slop to create a homebrew cask. Could this be called claude instead of claude-code? We are slowly consolidating around that naming for the package.

The auto-updater is very important to us and we want that to be the default—that is the main benefit of claude install over handling everything directly in homebrew. We can definitely provide claude uninstall but we also want to be good homebrew citizens and observe the local customs, so happy to take some input if you want to give it.

wolffiex avatar Jul 15 '25 06:07 wolffiex

A Homebrew cask has now been added (https://github.com/Homebrew/homebrew-cask/pull/219994, brew.sh).

nihaals avatar Jul 19 '25 12:07 nihaals

A Homebrew cask has now been added (Homebrew/homebrew-cask#219994, brew.sh).

@nihaals Works like a charm! Thank you 💪

xshapira avatar Jul 19 '25 14:07 xshapira

Working for me too! Thanks everyone; you guys are awesome 🥳

mieubrisse avatar Jul 21 '25 14:07 mieubrisse

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Jul 29 '25 16:07 github-actions[bot]