以下の内容はhttps://kazuhira-r.hatenablog.com/entry/2025/11/02/235534より取得しました。


Claude Codeのネイティブ版をインストールする

これは、なにをしたくて書いたもの?

Claude Codeの推奨方法がネイティブインストールになったということなので。

Quickstart / Step 1: Install Claude Code

ちょっとどういうものか見てみたくなりまして。

動作というよりは、バイナリーの話です。バイナリーの。

環境

今回の環境はこちら。

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.3 LTS
Release:        24.04
Codename:       noble


$ uname -srvmpio
Linux 6.8.0-87-generic #88-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 09:28:41 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

ネイティブ版のClaude Codeをインストールする

Claude Codeのネイティブ版のインストール方法は、よくあるcurlbashを使ったものです。

Quickstart / Step 1: Install Claude Code

つまり、こちら。

$ curl -fsSL https://claude.ai/install.sh | bash

~/.local/bin/claudeにインストールされたと言われます。

Setting up Claude Code...

✔ Claude Code successfully installed!

  Version: 2.0.31

  Location: ~/.local/bin/claude


  Next: Run claude --help to get started

⚠ Setup notes:
  • Native installation exists but ~/.local/bin is not in your PATH. Run: echo 'export PATH="$HOME/.local/bin:$PATH"' >> your shell config file && source your shell config
  file


✅ Installation complete!

また~/.local/binPATHが通っていないと警告されるようですが、XDG Base Directory Specificationに従っているディストリビューションであれば
新しくシェルを起動すれば反映されるでしょう。

$HOME/.local/binってなんだ?(XDG Base Directory Specification) - CLOVER🍀

インストール先の確認。

$ which claude
$HOME/.local/bin/claude

バージョン。

$ claude --version
2.0.31 (Claude Code)

ヘルプ。

$ claude --help
Usage: claude [options] [command] [prompt]

Claude Code - starts an interactive session by default, use -p/--print for non-interactive output

Arguments:
  prompt                                            Your prompt

Options:
  -d, --debug [filter]                              Enable debug mode with optional category filtering (e.g., "api,hooks" or "!statsig,!file")
  --verbose                                         Override verbose mode setting from config
  -p, --print                                       Print response and exit (useful for pipes). Note: The workspace trust dialog is skipped when Claude is run with the -p
                                                    mode. Only use this flag in directories you trust.
  --output-format <format>                          Output format (only works with --print): "text" (default), "json" (single result), or "stream-json" (realtime streaming)
                                                    (choices: "text", "json", "stream-json")
  --include-partial-messages                        Include partial message chunks as they arrive (only works with --print and --output-format=stream-json)
  --input-format <format>                           Input format (only works with --print): "text" (default), or "stream-json" (realtime streaming input) (choices: "text",
                                                    "stream-json")
  --mcp-debug                                       [DEPRECATED. Use --debug instead] Enable MCP debug mode (shows MCP server errors)
  --dangerously-skip-permissions                    Bypass all permission checks. Recommended only for sandboxes with no internet access.
  --allow-dangerously-skip-permissions              Enable bypassing all permission checks as an option, without it being enabled by default. Recommended only for sandboxes
                                                    with no internet access.
  --replay-user-messages                            Re-emit user messages from stdin back on stdout for acknowledgment (only works with --input-format=stream-json and
                                                    --output-format=stream-json)
  --allowedTools, --allowed-tools <tools...>        Comma or space-separated list of tool names to allow (e.g. "Bash(git:*) Edit")
  --tools <tools...>                                Specify the list of available tools from the built-in set. Use "" to disable all tools, "default" to use all tools, or
                                                    specify tool names (e.g. "Bash,Edit,Read"). Only works with --print mode.
  --disallowedTools, --disallowed-tools <tools...>  Comma or space-separated list of tool names to deny (e.g. "Bash(git:*) Edit")
  --mcp-config <configs...>                         Load MCP servers from JSON files or strings (space-separated)
  --system-prompt <prompt>                          System prompt to use for the session
  --append-system-prompt <prompt>                   Append a system prompt to the default system prompt
  --permission-mode <mode>                          Permission mode to use for the session (choices: "acceptEdits", "bypassPermissions", "default", "plan")
  -c, --continue                                    Continue the most recent conversation
  -r, --resume [sessionId]                          Resume a conversation - provide a session ID or interactively select a conversation to resume
  --fork-session                                    When resuming, create a new session ID instead of reusing the original (use with --resume or --continue)
  --model <model>                                   Model for the current session. Provide an alias for the latest model (e.g. 'sonnet' or 'opus') or a model's full name
                                                    (e.g. 'claude-sonnet-4-5-20250929').
  --fallback-model <model>                          Enable automatic fallback to specified model when default model is overloaded (only works with --print)
  --settings <file-or-json>                         Path to a settings JSON file or a JSON string to load additional settings from
  --add-dir <directories...>                        Additional directories to allow tool access to
  --ide                                             Automatically connect to IDE on startup if exactly one valid IDE is available
  --strict-mcp-config                               Only use MCP servers from --mcp-config, ignoring all other MCP configurations
  --session-id <uuid>                               Use a specific session ID for the conversation (must be a valid UUID)
  --agents <json>                                   JSON object defining custom agents (e.g. '{"reviewer": {"description": "Reviews code", "prompt": "You are a code
                                                    reviewer"}}')
  --setting-sources <sources>                       Comma-separated list of setting sources to load (user, project, local).
  --plugin-dir <paths...>                           Load plugins from directories for this session only (repeatable)
  -v, --version                                     Output the version number
  -h, --help                                        Display help for command

Commands:
  mcp                                               Configure and manage MCP servers
  plugin                                            Manage Claude Code plugins
  migrate-installer                                 Migrate from global npm installation to local installation
  setup-token                                       Set up a long-lived authentication token (requires Claude subscription)
  doctor                                            Check the health of your Claude Code auto-updater
  update                                            Check for updates and install if available
  install [options] [target]                        Install Claude Code native build. Use [target] to specify version (stable, latest, or specific version)

アップデートはclaude updateのようですね。

$ claude update
Current version: 2.0.31
Checking for updates...
Claude Code is up to date (2.0.31)

これでもいいんでしょうか。

$ claude install latest

✔ Claude Code successfully installed!

  Version: 2.0.31

  Location: ~/.local/bin/claude


  Next: Run claude --help to get started

インストールされたバイナリーをfileコマンドで見てみると、シンボリックリンクのようです。

$ file $(which claude)
/home/user/.local/bin/claude: symbolic link to /home/file/.local/share/user/versions/2.0.31

シンボリックリンク先をfileコマンドで見てると、実行可能バイナリーになっていますね。

$ file /user/user/.local/share/claude/versions/2.0.31
/home/user/.local/share/claude/versions/2.0.31: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=668a1c029f30aa64ce77170cdab8fc16233395b1, not stripped

113Mあります。

$ ll -h /home/user/.local/share/claude/versions/2.0.31
-rwxr-xr-x 1 user user 113M 11月  2 21:54 /home/user/.local/share/claude/versions/2.0.31*

lddで見てみます。

$ ldd /home/user/.local/share/claude/versions/2.0.31
        linux-vdso.so.1 (0x00007fff26dbc000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9a41400000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f9a416c6000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9a416b9000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9a416b4000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9a41317000)

readelfで見てみると、Rustも使われていそうな感じもしますが

$ readelf -p .comment /home/user/.local/share/claude/versions/2.0.31

セクション '.comment' の文字列ダンプ:
  [     0]  Linker: Ubuntu LLD 19.1.7
  [    1a]  GCC: (Ubuntu 13.1.0-8ubuntu1~20.04.2) 13.1.0
  [    47]  Ubuntu clang version 19.1.7 (++20250114103238+cd708029e0b2-1~exp1~20250114103342.77)
  [    9c]  rustc version 1.92.0-nightly (7ac0330c6 2025-09-25)

C、C++で実装されたアプリケーションかなと思います。

$ nm -C /home/user/.local/share/claude/versions/2.0.31 | grep main
                 U __libc_start_main
                 U bind_textdomain_codeset

他にはこのあたりやV8がいるのも見えたり。

NAPI-RS – NAPI-RS

npmパッケージの場合は?

一応、npmパッケージ版も見ておきましょう。

$ npm i @anthropic-ai/claude-code

こちらの実体はcli.jsへのシンボリックリンクです。

$ file node_modules/.bin/claude
node_modules/.bin/claude: symbolic link to ../@anthropic-ai/claude-code/cli.js

こちらはしっかりJavaScriptですね。

$ file node_modules/@anthropic-ai/claude-code/cli.js
node_modules/@anthropic-ai/claude-code/cli.js: Node.js script executable, ASCII text, with very long lines (40849)



以上の内容はhttps://kazuhira-r.hatenablog.com/entry/2025/11/02/235534より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14