Slides used in Session 4 of the on-demand part of the course "Prompt Engineering: Applications of Generative AI" offered by the Graduate School of Business and Finance at Waseda University in the spring quarter of 2026.
Engineering — Applications of Generative AI, Spring 2026 On-Demand Materials, Session 4: “Running a Coding Agent (macOS Lima Edition)” Kenji Saito Waseda University, Graduate School of Business and Finance (WBS: Waseda Business School) Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.1/21
the Instructor • No. 2 Introduction of the Instructor’s Research • No. 3 Running a Coding Agent (Windows WSL Edition) • No. 4 Running a Coding Agent (macOS Lima Edition) • No. 5 Running a Coding Agent (macOS Native Edition) No. 6 How to Use Chatbots in This Course No. 7 Principles of Large Language Models and How to Use Them No. 8 Prompts for Handling and Translating Natural Language No. 9 RPG as a Serious Game No. 10 Structure of Prompts for the “September 12th” Game No. 11 Expanding Knowledge Through Dialogue No. 12 Attacks on and Defense Against Prompts No. 13 Theory of Active Listening ∼ Creating a Listening Companion No. 14 Discussion Points on AGI (Artificial General Intelligence) Please watch through Session 7 as early as possible (by around 4/27) / Watching at speed (e.g., 2x) is fine! For anything unclear, leave a comment with a timestamp! / Writing “what you understood and why it was still confusing” is helpful Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.3/21
runs software using generative AI Since computers run on software, a coding agent can in principle do anything a computer can do When given a goal, it breaks it into subtasks, plans and executes them, and autonomously corrects failures and continues (Automation of A-Thinking) AI applications are evolving from dialogue with humans to replacing human tasks (agents) Coding agents, which embody the basic operations of an agent, serve as the core for automating all computer-based work Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.4/21
macOS users Installing Homebrew (package manager) Installing and setting up lima (Linux virtual environment) Installing loglm (AI launcher with logging) Installing GAMER PAT CLI (research as a serious game) The following tools are also installed (semi-)automatically npm (JavaScript package manager) Codex / Claude Code / Gemini CLI (coding agents) TeX Live (typesetting system) (desktop publishing system) Skim (PDF file viewer) ⇒ An environment for enjoyably writing academic papers with generative AI is set up We assume you have a paid subscription to one of ChatGPT, Claude, or Gemini Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.5/21
the UNIX family At least its core (kernel) is free software, with its source code open, freely usable, modifiable, and redistributable under the same license Android and ChromeOS, both OS products by Google, also use the Linux kernel A bundled collection of the Linux kernel and other software, made easy to install and use, is called a “Linux distribution (distro)” We use Ubuntu 24.04 LTS as our distribution this time LTS: Long-Term Support Linux is one of the key components supporting today’s information network environment Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.6/21
up a Linux machine, there is additional significance In future sessions, we will demonstrate AI agents on Linux Since it can automatically do anything the local computer can do, it could potentially destroy the system if something goes wrong Therefore, by running in a virtual machine, we ensure the physical machine’s system is not affected Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.7/21
Silicon (M1 or later) is required In a terminal window, run the following to install the command-line developer tools (‘%’ is the prompt) % xcode-select --install Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.8/21
(that Apple did not include in macOS) Homebrew is needed whether you use macOS directly or via Lima If you have been using brew since the Intel era and migrated your environment to an Apple Silicon machine as-is, please repent and uninstall brew (the installation page has a script for this) before reinstalling All tools previously installed via brew must also be reinstalled! Installation steps Latest method Download the latest release pkg file from https://github.com/Homebrew/brew/releases and install it If the path is not set (i.e., running brew says command not found) Add the following to the file “.zshrc” in your home folder (create it if it does not exist) eval "$(/opt/homebrew/bin/brew shellenv)" Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.9/21
Linux virtual machines (containers) on macOS, etc. https://github.com/lima-vm/lima The name stands for Linux machine Install with brew % brew install lima Move into your working folder (create it if needed) In a terminal window, type cd followed by a space, then drag and drop the folder icon into the terminal window. It will look like the following; press RETURN/ENTER % cd <path to folder> cd stands for change directory Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.10/21
24.04 (ARM64) virtual machine using a configuration file Download “arm.yaml” from here and move it to your working folder Edit the file with TextEdit or similar so that the mounts: section reads as follows mounts: - location: "~" - location: "/tmp/lima" writable: true - location: "<path to working folder>" writable: true arch: aarch64 The following command may take a while; please be patient % limactl start arm.yaml Press Enter to continue Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.11/21
architecture is aarch64 % limactl list Enter the Linux shell (use the exit command to leave) % limactl shell arm From now on, you can enter the Linux shell with the above command at any time If limactl list shows STATUS as Stopped, first run limactl start arm to start it Virtual machine files are stored under “.lima” in the user’s home directory Normally you do not need to worry about this, but The diffdisk inside can grow to around 100GB with continued use, so for now please treat this as a short-term setup rather than long-term Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.12/21
to your working directory (folder) (‘$’ is the prompt) $ cd <path to folder> Let’s check the Python version $ python3 -V It should be Python 3.12.3 You may not use it much (depends on what you want to do) For statistical analysis and graphing, we actually recommend R You can install it (semi-)automatically by asking the AI Either way, humans do not write code directly! Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.13/21
launching coding agents By always launching the coding agent through loglm Unless you add the --new option, it continues from the last session All terminal logs are retained, so you can reference previous context (across agents) You can install agents described as a collection of prompts Since coding agents can do anything a computer can do, they are useful beyond coding Everyone can freely define and use their own agents Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.14/21
from ↑ $ curl -fsSL https://raw.githubusercontent.com/ks91/loglm/main/install.sh | bash Restart the shell (the interface for using the OS — here, essentially the terminal window) $ exec $SHELL -l Then, by launching loglm, you can automatically install the coding agent selected at startup Codex for ChatGPT users, Claude Code for Claude users, and Gemini CLI for Gemini users Log into each generative AI account in your browser (for authentication) Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.15/21
Codex, Claude Code, or Gemini CLI is basically done in the browser where you are logged into the respective generative AI account However, in lima, you cannot use the browser directly Each generative AI has its own workaround; for ChatGPT, “device code authentication” is used Open the ChatGPT settings page in your browser Click your account name in the lower left and select “Settings” Select “Security” from the left column Turn ON “Enable device code authentication for Codex” (near the bottom) Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.16/21
agent that turns research into a game You can use the coding agent without installing this, but since you are graduate students, you will surely do research Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.17/21
(folder) you will use for writing papers $ mkdir <folder name> # make directory $ cd <folder name> # change directory Install everything at once $ loglm agent install ks91/gamer-pat It quickly says “installation complete,” but that only refers to the GAMER PAT files First, you will be asked whether to use 1: codex, 2: claude, or 3: gemini Choose one; you will be asked if you want to install the missing command — press “y” Then you will be asked if you want to install the required npm — press “y” If it stops, it means the command was installed but the shell needs to be restarted $ exec $SHELL -l Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.18/21
Authentication will be requested; authenticate using your generative AI account Basically, copy the URL shown on screen and open it in your browser Authentication is only required once per execution environment (e.g., per virtual machine) Once done, the coding agent will be ready to accept input In this case, it is standing by as the installed GAMER PAT To use it as a plain coding agent, cd into your working directory (create it with mkdir if needed, then go there) and launch with $ loglm $ loglm --agent lets you switch the coding agent Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.19/21
the coding agent (‘>’ is the prompt) > Let’s begin. The installation status of required tools will be checked Follow the instructions given to install each tool with the specified commands For commands starting with sudo, open another terminal window running lima, copy-paste, and run them there Skim (PDF file viewer) is installed on macOS When the installation in the other window is complete, tell PAT “I’m done” Completion may take some time Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.20/21
papers in L A TEX, compile them to PDF, and progress your writing while previewing Since humans do not write code, L A TEX knowledge is not required, but having some helps you use it better That’s true of everything, isn’t it Skim (macOS app) is used for previewing PDF files In Skim, go to Preferences → Sync and check “Check for file changes” As a demo, we will also try the other two coding agents Prompt Engineering, Spring 2026 — On-Demand Session 4: “Running a Coding Agent (macOS Lima Edition)” — 2026-04 – p.21/21