Skip to main content
The React Native SSH SFTP library works on both iOS and Android, but there are important platform-specific differences and limitations you should be aware of.

iOS vs Android Differences

Connection Methods

The underlying implementation differs between platforms:

SFTP Disconnect

The disconnectSFTP() method behaves differently on iOS:
On iOS, the SFTP channel isn’t explicitly closed when calling disconnectSFTP(). The workaround is to call client.disconnect() which closes both SSH and SFTP connections.

File Permissions (chmod)

The sftpChmod() method is only available on Android.

Event Emitters

The platforms use different event emitter implementations:
  • iOS: Uses NativeEventEmitter
  • Android: Uses DeviceEventEmitter
This difference is handled internally, so you don’t need to worry about it in your application code.

iOS Simulator Limitations

The library does not work on iOS simulators. You must test on a physical iOS device.

Why Simulators Don’t Work

The iOS implementation uses the NMSSH library, which depends on native SSH libraries that are not available in the iOS simulator environment.

Workaround

Development Strategy

1

Use Android Emulator for development

The Android emulator fully supports SSH operations:
2

Test on physical iOS device

For iOS testing, always use a physical device:
3

Implement platform checks

Add runtime checks to gracefully handle simulator scenarios:

OpenSSL and Flipper Conflicts

The Problem

Flipper (React Native’s debugging tool) includes its own copy of OpenSSL, which conflicts with the OpenSSL version used by NMSSH.
If you experience build errors or runtime crashes on iOS related to OpenSSL, you may need to disable Flipper.

Symptoms

  • Build failures with duplicate symbol errors
  • Crashes on app launch
  • SSH connection failures with cryptic OpenSSL errors

Solution: Disable Flipper

Edit your ios/Podfile:
Then reinstall pods:

Alternative: Use Expo Dev Tools

If you need debugging capabilities, consider using Expo Dev Tools or React Native Debugger instead of Flipper.

Native Library Dependencies

The library wraps different native SSH implementations on each platform:
NMSSH Library
  • Based on libssh
  • Requires manual Podfile configuration
  • Uses aanah0’s fork for updated libssh version
After modifying the Podfile:

Best Practices for Cross-Platform Development

1

Abstract platform differences

Create wrapper functions that handle platform-specific code:
2

Test on both platforms

Always test your SSH functionality on both platforms:
3

Graceful degradation

Handle unavailable features gracefully:

Known Issues and Workarounds

Issue: SSH functionality doesn’t work on iOS simulator.Workaround: Use physical iOS device for testing, or develop/test primarily on Android emulator.See: GitHub Issue #20
Issue: disconnectSFTP() doesn’t fully close the SFTP channel on iOS.Workaround: Use disconnect() to close both SSH and SFTP connections.
Issue: Flipper’s OpenSSL conflicts with NMSSH’s OpenSSL.Workaround: Disable Flipper in your Podfile.
Issue: iOS doesn’t have native chmod support.Workaround: Use SSH execute() with chmod command.

Platform Detection Utilities

Here’s a utility module for common platform checks:

Next Steps

Last modified on March 26, 2026