LoginSignup
3
2

More than 1 year has passed since last update.

Go製プレゼンツール「present」のインストール手順

Posted at

この記事は Go Advent Calendar 2022 の7日目(代打)の記事です.

はじめに

愛用しているGo製プレゼンツール「present」ですが、毎回インストール手順を忘れてしまっているのでここに記します。(go module 対応してからコマンド一発で起動しなくなったので余計に...)

作業手順

今回は macOS Ventura 13.0.1 で行っています。

事前準備

Go本体のインストールを、お忘れなく!

Goのワークスペースを作成

ホームディレクトリー配下に go/ ディレクトリーを作成します。

% cd
% mkdir go

PATHを通しておく

ホームディレクトリー配下の .zshrc ファイルにて、インストールした present コマンドを実行できるようにパスを通しておきます。bin/ ディレクトリーはインストール時に自動作成されます。

% cat .zshrc
...
export PATH=$PATH:$HOME/go/bin
...

インストール

現時点で最新版である Go 1.19.4 を使用しているので go install コマンドでインストールします。Go 1.18 から go get コマンドでインストールできなくなったことはGo存じですよね?

% go install golang.org/x/tools/cmd/present@latest

実行

present コマンドを実行するとエラーになります。

% present
Couldn't find gopresent files: no required module provides package golang.org/x/tools/cmd/present: go.mod file not found in current directory or any parent directory; see 'go help modules'

By default, gopresent locates the slide template files and associated
static content by looking for a "golang.org/x/tools/cmd/present" package
in your Go workspaces (GOPATH).

You may use the -base flag to specify an alternate location.

-base オプションで、スライドのテンプレート場所を指定して起動します。

x/tools の後に指定するバージョンは次のサイトで確認できます。

@latest を指定してインストールしたので最新を確認。バージョンは 2022年12月6日の @v0.4.0 です。

% present -base /Users/[ユーザー名]/go/pkg/mod/golang.org/x/tools@v0.4.0/cmd/present
2022/12/10 19:40:32 Open your web browser and visit http://127.0.0.1:3999

Webブラウサーにて http://127.0.0.1:3999 にアクセスすれば完了です。

さいごに

今回の方法は present コマンドとのいうよりも、ソースコードからGo製コマンドをインストールする方法ですね。Go参考までに!q@w@p

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2