Skip to content

forge script fails with Internal transport error: Socket operation on non-socket (os error 38) on macOS #10595

Closed as not planned
@anas3182003

Description

@anas3182003

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

1.1.0

What version of Foundryup are you on?

1.1.0

What command(s) is the bug in?

forge script

Operating System

macOS (Apple Silicon)

Describe the bug

When attempting to run a deployment script using forge script on macOS, I consistently encounter the following error:

nginx
copy code
Internal transport error: Socket operation on non-socket (os error 38)
This happens even on the latest version of Foundry, and despite using valid RPC and private key values.

Command:

bash
Copy code
forge script script/deploySimpleStorage.s.sol
--rpc-url $Sepolia_RPC_URL
--private-key $PRIVATE_KEY
--broadcast -vvvv
Expected behavior:
The script should execute and deploy the contract without error, assuming the provided RPC and private key are valid.

Actual behavior:
The command fails with:

nginx
Copy code
Internal transport error: Socket operation on non-socket (os error 38)
Environment:

Hardware: MacBook Air M1

RPC node Provider: any providor

Project location: Local drive (not cloud-synced)

System Integrity Protection: Enabled

Used sudo?: Only for testing — not needed when bug appears

Steps to Reproduce:

Create a Foundry project

Write a simple deploy script without any vm.createFork usage

Run with forge script using a valid --rpc-url and --private-key

Observe error output

Notes:

Bug disappears when running with sudo (likely a permissions/sockets issue)

No forking is being used

.env variables are correctly exported

Happens even when run from env -i bash --noprofile --norc (clean env)

Possibly related to how sockets or file descriptors are handled on macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-bugType: bugT-needs-triageType: this issue needs to be labelled

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions